commit ca7cc0ac00520d72305da070d8ab0125e2042651
parent 8786e09c51397db537ac5b334096f09c48219263
Author: John Kubach <johnkubach@gmail.com>
Date: Sun, 2 Aug 2020 14:42:09 -0400
Reorganize Directory Structure
Diffstat:
5 files changed, 39 insertions(+), 39 deletions(-)
diff --git a/extract_info_functions.py b/extract_info_functions.py
@@ -1,36 +0,0 @@
-import youtube_dl
-import pylast
-from youtube_title_parse import get_artist_title
-from lastfm_init import lastfm_network
-
-def get_title(url):
- ytdl_opts = {'source_address': '0.0.0.0'}
- ydl = youtube_dl.YoutubeDL(ytdl_opts)
- with ydl:
- video = ydl.extract_info(url, download=False)
- title = video['title']
-
- return title
-
-def get_artist_song(title):
- try:
- artist, song = get_artist_title(title)
- except TypeError as e:
- artist = None
- song = None
-
- return artist, song
-
-def get_artist_info(artist):
- info = lastfm_network.get_artist(artist).get_bio_summary()
- return info
-
-def get_tags(artist):
- info = lastfm_network.get_artist(artist).get_top_tags(limit=2)
- genre_list = []
- for t in info:
- genre_list.append(t.item.get_name())
-
- format_tags = ', '.join(genre_list)
-
- return format_tags
diff --git a/element_functions.py b/functions/element.py
diff --git a/functions/extract_info.py b/functions/extract_info.py
@@ -0,0 +1,36 @@
+import youtube_dl
+import pylast
+from youtube_title_parse import get_artist_title
+from functions.lastfm_init import lastfm_network
+
+def get_title(url):
+ ytdl_opts = {'source_address': '0.0.0.0'}
+ ydl = youtube_dl.YoutubeDL(ytdl_opts)
+ with ydl:
+ video = ydl.extract_info(url, download=False)
+ title = video['title']
+
+ return title
+
+def get_artist_song(title):
+ try:
+ artist, song = get_artist_title(title)
+ except TypeError as e:
+ artist = None
+ song = None
+
+ return artist, song
+
+def get_artist_info(artist):
+ info = lastfm_network.get_artist(artist).get_bio_summary()
+ return info
+
+def get_tags(artist):
+ info = lastfm_network.get_artist(artist).get_top_tags(limit=2)
+ genre_list = []
+ for t in info:
+ genre_list.append(t.item.get_name())
+
+ format_tags = ', '.join(genre_list)
+
+ return format_tags
diff --git a/lastfm_init.py b/functions/lastfm_init.py
diff --git a/music.py b/music.py
@@ -3,8 +3,8 @@
import sys
import re
import configparser
-import element_functions
-from extract_info_functions import (
+import functions.element as element
+from functions.extract_info import (
get_title,
get_artist_song,
get_artist_info,
@@ -72,7 +72,7 @@ def main():
client.start_listener_thread()
while True:
- msg = element_functions.get_input()
+ msg = element.get_input()
room.send_text(msg)