Ensure ISRC in fallback dee to spo link conversion
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
|
import re
|
||||||
from deezspot.deezloader.dee_api import API
|
from deezspot.deezloader.dee_api import API
|
||||||
from deezspot.easy_spoty import Spo
|
from deezspot.easy_spoty import Spo
|
||||||
from deezspot.deezloader.deegw_api import API_GW
|
from deezspot.deezloader.deegw_api import API_GW
|
||||||
@@ -437,7 +438,12 @@ class DeeLogin:
|
|||||||
_sim(spo_title, dz_json.get('title_short', '')),
|
_sim(spo_title, dz_json.get('title_short', '')),
|
||||||
)
|
)
|
||||||
album_match = _sim(spo_album_title, (dz_json.get('album') or {}).get('title', ''))
|
album_match = _sim(spo_album_title, (dz_json.get('album') or {}).get('title', ''))
|
||||||
if title_match >= 0.90 and album_match >= 0.90 and tn == spo_tracknum:
|
t_isrc = (dz_json.get('isrc') or '').upper()
|
||||||
|
# Enforce ISRC match strictly in ISRC lookup path
|
||||||
|
if (
|
||||||
|
t_isrc and spo_isrc and t_isrc == spo_isrc and
|
||||||
|
title_match >= 0.90 and album_match >= 0.90 and tn == spo_tracknum
|
||||||
|
):
|
||||||
return f"https://www.deezer.com/track/{dz_json.get('id')}"
|
return f"https://www.deezer.com/track/{dz_json.get('id')}"
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
@@ -472,7 +478,8 @@ class DeeLogin:
|
|||||||
if tn != spo_tracknum:
|
if tn != spo_tracknum:
|
||||||
continue
|
continue
|
||||||
t_isrc = (dzc.get('isrc') or '').upper()
|
t_isrc = (dzc.get('isrc') or '').upper()
|
||||||
if spo_isrc and t_isrc and t_isrc != spo_isrc:
|
# Enforce ISRC strictly in fallback path as well: require present and equal
|
||||||
|
if not spo_isrc or not t_isrc or t_isrc != spo_isrc:
|
||||||
continue
|
continue
|
||||||
return f"https://www.deezer.com/track/{c_id}"
|
return f"https://www.deezer.com/track/{c_id}"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user