Skip to content

Commit

Permalink
loading ids.txt from package path
Browse files Browse the repository at this point in the history
  • Loading branch information
jongwook committed Apr 30, 2020
1 parent 2b02fbd commit 9bc7b5a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
recursive-include jukebox *.py
recursive-include jukebox *.txt
10 changes: 6 additions & 4 deletions jukebox/data/artist_genre_processor.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import re

accepted = frozenset([chr(i) for i in range(ord('a'), ord('z') + 1)] +
Expand Down Expand Up @@ -26,12 +27,13 @@ def create_reverse_lookup(atoi):
class ArtistGenreProcessor():
def __init__(self, v3=False):
self.v3 = v3
dirname = os.path.dirname(__file__)
if self.v3:
self.artist_id_file = "jukebox/data/ids/v3_artist_ids.txt"
self.genre_id_file = "jukebox/data/ids/v3_genre_ids.txt"
self.artist_id_file = f"{dirname}/ids/v3_artist_ids.txt"
self.genre_id_file = f"{dirname}/ids/v3_genre_ids.txt"
else:
self.artist_id_file = "jukebox/data/ids/v2_artist_ids.txt"
self.genre_id_file = "jukebox/data/ids/v2_genre_ids.txt"
self.artist_id_file = f"{dirname}/ids/v2_artist_ids.txt"
self.genre_id_file = f"{dirname}/ids/v2_genre_ids.txt"
self.load_artists()
self.load_genres()

Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@
open(os.path.join(os.path.dirname(__file__), "requirements.txt"))
)
],
include_package_data=True
)

0 comments on commit 9bc7b5a

Please sign in to comment.