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
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 rest of the dependencies using `pip install -r requirements.txt`<br>
Run `python -m deemix` to run the app
Install the dependencies using `pip install -r requirements.txt`<br>
Run `python -m deemix --help` to see how to use the app
# TODO
Find all dependencies and add them to requirements.txt<br>
Making the download work in multi-threading<br>
Add the settings in the GUI<br>
Finish porting all features
Finish porting all features<br>
Make the GUI after all is implemented

View File

@ -1,9 +1,28 @@
#!/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__':
app = wx.App()
frame = MainFrame()
app.MainLoop()
download()

View File

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

View File

@ -1,6 +1,17 @@
#!/usr/bin/env python3
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):
if '?' in link:
link = link[:link.find('?')]

View File

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