magicgoose / simple_dr_meter

An (optimized) implementation of the music DR measurement (compliant with http://dr.loudness-war.info/), it supports CUE sheets and is faster than all currently available alternatives (at the time of writing, not sure about now)
GNU General Public License v3.0
20 stars 3 forks source link

Fails when launched 'python3 /path/to/main.py' with cuesheet input #7

Closed spvkgn closed 3 years ago

spvkgn commented 3 years ago

$ python3 /tmp/simple_dr_meter/main.py Deep\ Purple\ -\ Machine\ Head\ \(Japan\ 32XD-564\)\ \[1st\ Pressing\].cue 
Traceback (most recent call last):
  File "/tmp/simple_dr_meter/main.py", line 238, in <module>
    main()
  File "/tmp/simple_dr_meter/main.py", line 126, in main
    dr_log_items, dr_mean, dr_median = analyze_dr(in_path, track_cb, keep_precision)
  File "/tmp/simple_dr_meter/main.py", line 152, in analyze_dr
    audio_info = tuple(read_audio_info(in_path))
  File "/tmp/simple_dr_meter/audio_io/audio_io.py", line 240, in read_audio_info
    yield from _translate_from_cue(parse_cue_str(cue_str), directory_path=os.path.dirname(in_path))
  File "/tmp/simple_dr_meter/audio_io/audio_io.py", line 176, in _translate_from_cue
    raise ValueError
ValueError
$ python3 /tmp/simple_dr_meter/main.py Deep\ Purple\ -\ Machine\ Head\ \(Japan\ 32XD-564\)\ \[1st\ Pressing\].flac 
01 - None: DR13
Official DR = 13, Median DR = 13.0
Analyzed all tracks in 9.42 seconds
writing log to dr.txt
Traceback (most recent call last):
  File "/tmp/simple_dr_meter/main.py", line 238, in <module>
    main()
  File "/tmp/simple_dr_meter/main.py", line 134, in main
    write_log(f.write, dr_log_items, dr_mean)
  File "/tmp/simple_dr_meter/main.py", line 54, in write_log
    group_name = get_group_title(group)
  File "/tmp/simple_dr_meter/main.py", line 35, in get_group_title
    return f'{", ".join(group.performers)} — {", ".join(group.albums)}'
TypeError: sequence item 0: expected str instance, NoneType found
magicgoose commented 3 years ago

What are the contents of the cuesheet? (you can freely share it btw, it doesn't consist of anything copyrightable) I suspect this could be some character encoding issue, but the error detection/reporting in this application is currently very lacking.

spvkgn commented 3 years ago

There is nothing unusual in cuesheet https://paste.ubuntu.com/p/K9jFbD7HDz/ It works well when main.py launched from current directory:

$ python3 main.py ../1972.\ Machine\ Head\ \(1987\,\ Warner-Pioneer\,\ Japan\,\ 32XD-564\)/Deep\ Purple\ -\ Machine\ Head\ \(Japan\ 32XD-564\)\ \[1st\ Pressing\].cue 
01 - Highway Star: DR11
02 - Maybe I'm A Leo: DR13
03 - Pictures Of Home: DR12
04 - Never Before: DR11
05 - Smoke On The Water: DR13
06 - Lazy: DR11
07 - Space Truckin': DR12
Official DR = 12, Median DR = 12.0
Analyzed all tracks in 12.24 seconds
writing log to ../1972. Machine Head (1987, Warner-Pioneer, Japan, 32XD-564)/dr.txt
…done

But fails when setting path to main.py as above.

magicgoose commented 3 years ago

Ah now I understand it, thanks for the details. Will attempt to fix it some time soon..

magicgoose commented 3 years ago

@spvkgn I tried to reproduce it, but no luck. All the combinations of absolute/relative paths, current directories, etc., work fine. I suspect this could be specific to Python version. Does this happen with Python 3.9.5? Also can you try again with this branch?: https://github.com/magicgoose/simple_dr_meter/tree/issue-7-paths-problem
There I added a small change (convert path to absolute at the very beginning) which maybe should eliminate this difference.

spvkgn commented 3 years ago

@magicgoose Don't know how to install Python 3.9.5 in Ubuntu 20.04 yet, maybe I'll figure it out later. I've tried with the new branch and it works fine with Python 3.8.5. Thanks!