Skip to content

Commit a7aceb2

Browse files
committed
Can now start program with "v2mp3" from CLI.
- Added entry-point script "v2mp3". - Placed output into its own frame for consistency. - Added comments to "V2Mp3/appEvents/events.py". - Updates to README.md. Signed-off-by: schlopp96 <71921821+schlopp96@users.noreply.github.com>
1 parent e3242af commit a7aceb2

File tree

5 files changed

+41
-15
lines changed

5 files changed

+41
-15
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,22 @@
8989

9090
> Using _**`V2Mp3`**_ is generally straightforward, with directions and tooltips built in to the GUI describing what to do if you're confused.
9191
92+
- You can quickly start _**`V2Mp3`**_ using this simple CLI command:
93+
94+
```shell
95+
v2mp3
96+
```
97+
98+
- Other ways to start V2Mp3 include:
99+
100+
- Entering `python -m V2Mp3` in a terminal.
101+
- Importing _**`V2Mp3`**_ in a python environment and calling _`V2Mp3.v2mp3()`_ from within that environment (as illustrated above).
102+
- Opening `"~/V2Mp3/main.pyw"` from a file explorer.
103+
104+
---
105+
106+
## Structure
107+
92108
### **First Containing Frame**
93109

94110
- Home to the _**YouTube**_ download section

V2Mp3/appEvents/events.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
__version__ = '0.2.0'
1212

13-
logger = setLogger("V2Mp3")
13+
logger = setLogger("V2Mp3") # Set up logger
1414

1515
_textborder: str = "=".ljust((78),
1616
"=") # Text border for log file organization.
@@ -180,8 +180,10 @@ def toMp3(self, filepath: str, save_as: str = None) -> None:
180180
f'Something went wrong during video to audio conversion...\n==> Intended video to be converted: "{filepath}"\n==> Intended conversion output: "{save_as}"\n==> Exception:\n==> {exc}\n==> Please try again!'
181181
)
182182

183+
183184
events = Events()
184185

186+
185187
def _event_loop() -> None:
186188
"""Processing for application events.
187189
@@ -232,9 +234,11 @@ def _event_loop() -> None:
232234
else:
233235
events.dl_ytVideo(vals['-URLInput-'])
234236
elif vals['-CB_AudioOnly-']:
235-
events.dl_ytAudio(vals['-URLInput-'], vals['-T2_SaveInput-'] + '.mp3')
237+
events.dl_ytAudio(vals['-URLInput-'],
238+
vals['-T2_SaveInput-'] + '.mp3')
236239
else:
237-
events.dl_ytVideo(vals['-URLInput-'], vals['-T2_SaveInput-'] + '.mp4')
240+
events.dl_ytVideo(vals['-URLInput-'],
241+
vals['-T2_SaveInput-'] + '.mp4')
238242

239243
layout.window.Close() # Close window and return resources to OS
240-
logger.info(f'Exiting application...\n{_textborder}')
244+
logger.info(f'Exiting application...\n{_textborder}')

V2Mp3/appGUI/layout.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,21 @@
101101
expand_x=True,
102102
element_justification='Center')
103103
],
104-
# Event Output
104+
# Event Output Frame
105105
[
106-
psg.Multiline(size=(70, 30),
107-
key='-Output-',
108-
disabled=True,
109-
auto_refresh=True,
110-
autoscroll=True,
111-
write_only=True,
112-
expand_x=True,
113-
expand_y=True)
106+
psg.Frame(None,
107+
layout=[[
108+
psg.Multiline(size=(70, 30),
109+
key='-Output-',
110+
disabled=True,
111+
auto_refresh=True,
112+
autoscroll=True,
113+
write_only=True,
114+
expand_x=True,
115+
expand_y=True)
116+
]],
117+
expand_x=True,
118+
expand_y=True)
114119
],
115120
[psg.Exit(button_color='red', tooltip='Exit application.')]
116121
]

V2Mp3/main.pyw

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ def main() -> None:
2222
2323
---
2424
25-
:returns: Program layout.window.
25+
:returns: Program window.
2626
:rtype: None
2727
"""
2828

29-
_event_loop()
29+
return _event_loop()
3030

3131

3232
if __name__ == '__main__':

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
packages=find_packages(),
1818
include_package_data=True,
1919
install_requires=[reqs],
20+
entry_points={'gui_scripts': ['v2mp3=V2Mp3.main:main']},
2021
classifiers=[
2122
"Development Status :: 3 - Alpha",
2223
"Intended Audience :: Education",

0 commit comments

Comments
 (0)