Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added basic GUI #11

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ pydub==0.14.2
urlparse3==1.0.3
wheel==0.24.0
youtube-dl==2015.12.23
easygui==0.97.4
5 changes: 2 additions & 3 deletions split.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import AmazonParser
import splitutil


class MyLogger(object):
def debug(self, msg):
pass
Expand Down Expand Up @@ -129,7 +128,7 @@ def my_hook(d):
tracksStarts = []
tracksTitles = []

regex = re.compile("(?P<start>.+)\s*\-\s*(?P<title>.+)")
regex = re.compile("(\d*\s\-\s)*(?P<start>\S+)\s*\-\s(?P<title>.+)") #Added support for tracklists in the format <track#> - <start> - <title>

print("Parsing " + TRACKS_FILE)
with open(TRACKS_FILE) as tracksF:
Expand All @@ -149,7 +148,7 @@ def my_hook(d):
else:
for i, line in enumerate(tracksF):
m = regex.match(line)

tStart = splitutil.timeToSeconds(m.group('start').strip())
tTitle = m.group('title').strip()

Expand Down
44 changes: 44 additions & 0 deletions splitAlbum.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import easygui as eg
import subprocess
import os
import re

source = eg.buttonbox(msg="How would you like to get the album?", title="Album Splitter", choices=("Youtube", "File"))

if source == "File":
link = "-mp3 \"" + os.path.abspath(eg.fileopenbox(msg="Select mp3 file", title="Album Splitter", default='*', filetypes="\*.mp3") + "\"")
else:
link = "-yt \"" + eg.enterbox(msg="Enter Youtube link", title="Album Splitter", default="", strip=True, image=None, root=None) + "\""

format = eg.choicebox(msg="Select format", title="Album Splitter", choices=("<start time> - <title>", "<start time> <title>")) #More formats can be added


tracks = eg.codebox(msg="Paste track list:", title="Album Splitter", text="")

#More formats can be added
if format == "<start time> - <title>":
with open("tracks.txt", 'w') as t:
t.write(tracks)
if format == "<start time> <title>":
tracks = tracks.split('\n')
regex = re.compile("(\d*\s\-\s)*(?P<start>\S+)\s*(?P<title>.+)")
for i in range(len(tracks)):
if tracks[i] != "":
m = regex.match(tracks[i])
tStart = m.group('start').strip()
tTitle = m.group('title').strip()
tracks[i] = tStart + " - " + tTitle
with open("tracks.txt", "w") as t:
t.write("\n".join(tracks))

try:
cmd = "python split.py " + link
print(cmd)
out = os.system(cmd) #I couldn't get this to work any other way, unfortunately.
#print(out)
#subprocess.call(("python split.py " + link))
#out_str = subprocess.check_output(cmd, shell=True)
#subprocess.Popen(cmd, shell=True)

except:
eg.exceptionbox(msg="Album Splitter has crashed", title="Album Splitter") #This doesn't actually do anything due to the way the splitter program is currently launched.