Skip to content

Commit

Permalink
Can now start program with "v2mp3" from CLI.
Browse files Browse the repository at this point in the history
- 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>
  • Loading branch information
schlopp96 committed Jun 12, 2022
1 parent e3242af commit a7aceb2
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 15 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,22 @@

> Using _**`V2Mp3`**_ is generally straightforward, with directions and tooltips built in to the GUI describing what to do if you're confused.
- You can quickly start _**`V2Mp3`**_ using this simple CLI command:

```shell
v2mp3
```

- Other ways to start V2Mp3 include:

- Entering `python -m V2Mp3` in a terminal.
- Importing _**`V2Mp3`**_ in a python environment and calling _`V2Mp3.v2mp3()`_ from within that environment (as illustrated above).
- Opening `"~/V2Mp3/main.pyw"` from a file explorer.

---

## Structure

### **First Containing Frame**

- Home to the _**YouTube**_ download section
Expand Down
12 changes: 8 additions & 4 deletions V2Mp3/appEvents/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

__version__ = '0.2.0'

logger = setLogger("V2Mp3")
logger = setLogger("V2Mp3") # Set up logger

_textborder: str = "=".ljust((78),
"=") # Text border for log file organization.
Expand Down Expand Up @@ -180,8 +180,10 @@ def toMp3(self, filepath: str, save_as: str = None) -> None:
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!'
)


events = Events()


def _event_loop() -> None:
"""Processing for application events.
Expand Down Expand Up @@ -232,9 +234,11 @@ def _event_loop() -> None:
else:
events.dl_ytVideo(vals['-URLInput-'])
elif vals['-CB_AudioOnly-']:
events.dl_ytAudio(vals['-URLInput-'], vals['-T2_SaveInput-'] + '.mp3')
events.dl_ytAudio(vals['-URLInput-'],
vals['-T2_SaveInput-'] + '.mp3')
else:
events.dl_ytVideo(vals['-URLInput-'], vals['-T2_SaveInput-'] + '.mp4')
events.dl_ytVideo(vals['-URLInput-'],
vals['-T2_SaveInput-'] + '.mp4')

layout.window.Close() # Close window and return resources to OS
logger.info(f'Exiting application...\n{_textborder}')
logger.info(f'Exiting application...\n{_textborder}')
23 changes: 14 additions & 9 deletions V2Mp3/appGUI/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,21 @@
expand_x=True,
element_justification='Center')
],
# Event Output
# Event Output Frame
[
psg.Multiline(size=(70, 30),
key='-Output-',
disabled=True,
auto_refresh=True,
autoscroll=True,
write_only=True,
expand_x=True,
expand_y=True)
psg.Frame(None,
layout=[[
psg.Multiline(size=(70, 30),
key='-Output-',
disabled=True,
auto_refresh=True,
autoscroll=True,
write_only=True,
expand_x=True,
expand_y=True)
]],
expand_x=True,
expand_y=True)
],
[psg.Exit(button_color='red', tooltip='Exit application.')]
]
Expand Down
4 changes: 2 additions & 2 deletions V2Mp3/main.pyw
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ def main() -> None:
---
:returns: Program layout.window.
:returns: Program window.
:rtype: None
"""

_event_loop()
return _event_loop()


if __name__ == '__main__':
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
packages=find_packages(),
include_package_data=True,
install_requires=[reqs],
entry_points={'gui_scripts': ['v2mp3=V2Mp3.main:main']},
classifiers=[
"Development Status :: 3 - Alpha",
"Intended Audience :: Education",
Expand Down

0 comments on commit a7aceb2

Please sign in to comment.