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

Different files of the same track aren't merged in same track #2

Open
NoMore201 opened this issue May 2, 2018 · 0 comments
Open

Different files of the same track aren't merged in same track #2

NoMore201 opened this issue May 2, 2018 · 0 comments

Comments

@NoMore201
Copy link
Collaborator

Problem description

Adding two files of the same track will generate two different track objects, each one with a different resource.

Steps to reproduce

For simplicity, just copy a track in a test folder and make a duplicate, for example

mkdir test-music
cd test-music
cp /path/to/mytrack.mp3 .
cp mytrack.mp3 mytrack-two.mp3

Then

1 - Set test folder in teriscore.conf
2 - Run mediascanner with the new folder
3 - Start tersicore

Expected result

Tersicore should generate a single track object with two different resources

Actual result

Tersicore generate two different tracks

Possible solution

The problem is in this part of the code

def update_resource(session, path):
res = get_resource(session, path)
if res is None:
res = Resource()
res.track = Track()
parse_resource(res, path)
session.add(res)

To check if a track exists, tersicore will check if an entry with the same path exists in the DB. But this is not enough, since we can have different files in different paths for the same track. IMO a good solution is to generate track UUID using an hash of toLowerCase(title) + toLowerCase(album) + toLowerCase(artist), rather than generating a random one. In this way the second file will have the same UUID as the first, and it will be merged in the first track as an additional resource.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant