diff --git a/Home.md b/Home.md index 9a21035..98812e2 100644 --- a/Home.md +++ b/Home.md @@ -55,4 +55,36 @@ for track in tracks: #break else: ids[id] = track +``` + +# Computing `MAXIMAL_NUMBER_OF_RESULTS` + +The updated algorithm initially published in 588b20409b5acc2e4412427ccd1d333847157400 is: + +```py +import os, json + +path = '/home/benjamin/Desktop/bens_folder/dev/yt/audio_library' + +os.chdir(path) + +with open('music.json') as json_file: + tracks = json.load(json_file) + +mostResults = 0 +mostResultsTitle = None + +for track in tracks: + title = track['title'] + results = 0 + for otherTrack in tracks: + # Doesn't used to have `replace` and `lower`, but it seems that it is what YouTube UI title search does. + title = title.replace('!', '') + if title.lower() in otherTrack['title'].lower(): + results += 1 + if results > mostResults: + mostResults = results + mostResultsTitle = title + +print(mostResults, mostResultsTitle) ``` \ No newline at end of file