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

Fix mediadb str issues #44

Merged
merged 32 commits into from
Mar 11, 2023
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
2d8359d
Add Python 3.9 to build matrix
palfrey Feb 5, 2022
43d416e
Add 3.9 build to travis
palfrey Feb 5, 2022
2897c36
Start mediadb work
palfrey Feb 5, 2022
89f0293
Document poetry version and update
palfrey Feb 5, 2022
062da0c
Merge branch 'poetry-1.1' into mediadb
palfrey Feb 6, 2022
7caf2d4
Update lock now poetry 1.1 is merged
palfrey Feb 6, 2022
bf39ede
Test mediadb and fix str encoding issue
palfrey Feb 6, 2022
9444fd4
Add mediadb requirements to dev list
palfrey Feb 6, 2022
1df4ffd
Add taglib deps
palfrey Feb 6, 2022
0570861
Upgrade tagpy
palfrey Feb 12, 2022
d7e6b1b
Lockdown twisted version to avoid deprecation
palfrey Feb 12, 2022
c8c3b79
Split out mediadb testing for just 3.6
palfrey Feb 12, 2022
31964e8
Actually have different sets of deps for different python versions
palfrey Feb 12, 2022
bc0a97f
Check against mediaddb_storage not tagpy
palfrey Feb 12, 2022
f983c2b
Remove some debug helpers
palfrey Feb 12, 2022
9c06971
Merge branch 'master' into mediadb
palfrey Feb 19, 2022
3e8481b
Merge branch 'master' into mediadb
palfrey Feb 19, 2022
eec0973
Update poetry.lock
palfrey Feb 19, 2022
cfe2a3f
Add mediadb deps to Github actions
palfrey Feb 19, 2022
970c5eb
Run coverage on 3.8 for mediadb tests
palfrey Feb 20, 2022
edd48d2
Fix tag types
palfrey Feb 20, 2022
aeacec5
Reset various things now there's a new tagpy version
palfrey Jan 8, 2023
f7a302a
Reset other 3.7/8 CI changes
palfrey Jan 8, 2023
e498045
Try and fix flake8 issue
palfrey Jan 8, 2023
867ab15
Lockdown flake8 version
palfrey Jan 9, 2023
50be9f5
Lockdown ubuntu version
palfrey Jan 9, 2023
9c00156
Try upping flake8 version
palfrey Jan 9, 2023
aa7c62b
Merge branch 'build-issues' into mediadb
palfrey Jan 9, 2023
de10b81
Drop Python 3.6 support
palfrey Mar 11, 2023
e958c5a
Add newline to end of test_mediadb_storage
palfrey Mar 11, 2023
74b1fc6
Merge branch 'master' into mediadb
palfrey Mar 11, 2023
51db456
Forgot to mark tagpy as optional
palfrey Mar 11, 2023
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
5 changes: 2 additions & 3 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ on: [push, pull_request]

jobs:
build:

runs-on: ubuntu-latest
runs-on: ubuntu-20.04 # 22.04 doesn't have Python 3.6
opacam marked this conversation as resolved.
Show resolved Hide resolved
env:
DISPLAY: ':99.0'
strategy:
Expand Down Expand Up @@ -36,7 +35,7 @@ jobs:
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .[dev]
python -m pip install .[dev,mediadb]
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ install:
- python -m pip install --upgrade --user pip setuptools wheel
- pip install --upgrade setuptools
- pip install --upgrade cython
- pip install .[dev]
- pip install .[dev,mediadb]
script:
# stop the build if there are Python syntax errors or undefined names
- flake8 --count --select=E9,F63,F7,F82 --show-source --statistics coherence/ tests/
Expand Down
26 changes: 13 additions & 13 deletions coherence/backends/mediadb_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def get_tags(filename):

def sanitize(filename):
badchars = ''.join(set(string.punctuation) - set('-_+.~'))
f = str(filename.lower())
f = filename.lower()
for old, new in (('ä', 'ae'), ('ö', 'oe'), ('ü', 'ue'), ('ß', 'ss')):
f = f.replace(str(old), str(new))
f = f.replace(badchars, '_')
Expand Down Expand Up @@ -583,12 +583,12 @@ def check_for_cover_art(path):
return ''

def got_tags(tags, file):
# print 'got_tags', tags
self.debug('got_tags', tags)

album = tags.get('album', '')
artist = tags.get('artist', '')
title = tags.get('title', '')
track = tags.get('track', 0)
album: bytes = tags.get('album', b'')
artist: bytes = tags.get('artist', b'')
title: bytes = tags.get('title', b'')
track: int = tags.get('track', 0)
Comment on lines +588 to +591
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, some Python types!!! 😄


if len(artist) == 0:
return
Expand All @@ -601,12 +601,12 @@ def got_tags(tags, file):
title = 'UNKNOWN_TITLE'
# print 'Tags:', file, album, artist, title, track

artist_ds = self.db.findOrCreate(Artist, name=str(artist, 'utf8'))
artist_ds = self.db.findOrCreate(Artist, name=artist.decode('utf-8'))
album_ds = self.db.findOrCreate(
Album, title=str(album, 'utf8'), artist=artist_ds
Album, title=album.decode('utf-8'), artist=artist_ds
)
if len(album_ds.cover) == 0:
dirname = str(os.path.dirname(file), 'utf-8')
dirname = os.path.dirname(file)
album_ds.cover = check_for_cover_art(dirname)
if len(album_ds.cover) > 0:
filename = f'{album_ds.artist.name} - {album_ds.title}'
Expand All @@ -619,12 +619,12 @@ def got_tags(tags, file):
)
album_ds.cover = filename
# print album_ds.cover
track_ds = self.db.findOrCreate(
self.db.findOrCreate(
Track,
title=str(title, 'utf8'),
track_nr=int(track),
title=title.decode('utf-8'),
track_nr=track,
album=album_ds,
location=str(file, 'utf8'),
location=file,
)

for file in self.filelist:
Expand Down
Loading