Shelved GUI and added cli usage instead

This commit is contained in:
RemixDev 2020-02-23 22:51:16 +01:00
parent 9e7411faf9
commit 4f3182783e
5 changed files with 48 additions and 14 deletions

View File

@ -1,10 +1,8 @@
# How to use # How to use
Install wxpython (check if there are builded packages for your distribution, if not then just run `pip install wxpython` and it should build it for your system)<br> Install the dependencies using `pip install -r requirements.txt`<br>
Install the rest of the dependencies using `pip install -r requirements.txt`<br> Run `python -m deemix --help` to see how to use the app
Run `python -m deemix` to run the app
# TODO # TODO
Find all dependencies and add them to requirements.txt<br>
Making the download work in multi-threading<br> Making the download work in multi-threading<br>
Add the settings in the GUI<br> Finish porting all features<br>
Finish porting all features Make the GUI after all is implemented

View File

@ -1,9 +1,28 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import wx import click
from deemix.utils.misc import getIDFromLink, getTypeFromLink, getBitrateInt
from deemix.app.downloader import download_track, download_album, download_playlist
from deemix.app.settings import initSettings
from deemix.ui.MainFrame import MainFrame @click.command()
@click.option('-b', '--bitrate', default=None, help='Overwrites the default bitrate selected')
@click.argument('url')
def download(bitrate, url):
settings = initSettings()
forcedBitrate = getBitrateInt(bitrate)
type = getTypeFromLink(url)
id = getIDFromLink(url, type)
if type == None or id == None:
click.echo("URL not recognized")
if type == "track":
download_track(id, settings, forcedBitrate)
elif type == "album":
download_album(id, settings, forcedBitrate)
elif type == "playlist":
download_playlist(id, settings, forcedBitrate)
else:
click.echo("URL not supported yet")
click.echo("All done!")
if __name__ == '__main__': if __name__ == '__main__':
app = wx.App() download()
frame = MainFrame()
app.MainLoop()

View File

@ -3,8 +3,11 @@
"tracknameTemplate": "%artist% - %title%", "tracknameTemplate": "%artist% - %title%",
"albumTracknameTemplate": "%number% - %title%", "albumTracknameTemplate": "%number% - %title%",
"playlistTracknameTemplate": "%position% - %artist% - %title%", "playlistTracknameTemplate": "%position% - %artist% - %title%",
"createPlaylistFolder": true,
"playlistNameTemplate": "%name%", "playlistNameTemplate": "%name%",
"artistNameTemplate": "", "createArtistFolder": false,
"artistNameTemplate": "%name%",
"createAlbumFolder": true,
"albumNameTemplate": "%artist% - %album%", "albumNameTemplate": "%artist% - %album%",
"createCDFolder": true, "createCDFolder": true,
"createStructurePlaylist": false, "createStructurePlaylist": false,
@ -23,8 +26,10 @@
"syncedLyrics": false, "syncedLyrics": false,
"embeddedArtworkSize": 800, "embeddedArtworkSize": 800,
"localArtworkSize": 1000, "localArtworkSize": 1000,
"coverImageTemplate": "", "saveArtwork": false,
"artistImageTemplate": "", "coverImageTemplate": "cover",
"saveArtworkArtist": false,
"artistImageTemplate": "folder",
"multitagSeparator": "default", "multitagSeparator": "default",
"dateFormat": "YMD", "dateFormat": "YMD",
"savePlaylistAsCompilation": false, "savePlaylistAsCompilation": false,

View File

@ -1,6 +1,17 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import re import re
def getBitrateInt(txt):
txt = str(txt)
if txt in ['flac', 'lossless', '9']:
return 9
elif txt in ['mp3', '320', '3']:
return 3
elif txt in ['128']:
return 1
else:
return None
def getIDFromLink(link, type): def getIDFromLink(link, type):
if '?' in link: if '?' in link:
link = link[:link.find('?')] link = link[:link.find('?')]

View File

@ -1,3 +1,4 @@
pyaes pyaes
blowfish blowfish
mutagen mutagen
click