Check some consistency (actually very bad) from YouTube Audio library using this Python script:
importos,json,subprocesspath='/home/benjamin/Desktop/bens_folder/dev/yt/audio_library'os.chdir(path)withopen('sound_effects.json')asjson_file:tracks=json.load(json_file)defexecute(command):returnsubprocess.check_output(command,shell=True).decode('utf-8')path='/home/benjamin/Downloads'os.chdir(path)ids={}fortrackintracks:#if track['title'] == 'Organic Guitar House':# print(track)#continue#print(track)duration=track['duration']#if not 'seconds' in duration and 'nanos' in duration and duration['nanos'] >= 10 ** 9:# print('both')#continueduration=duration['nanos']if'nanos'indurationelseint(duration['seconds'])*(10**9)# Add category for sound effect: _{track['attributes']['category']}attributes=track['attributes']category=attributes['category']if'category'inattributeselseNoneid=f"{track['artist']['name']}_{track['title']}_{duration}_{category}"ifidinids:print(id)fileName=f"{track['title']} - {track['artist']['name']}"command=f'cmp "{fileName}.mp3" "{fileName}(1).mp3"'#print(command)#execute(command)alreadyRegistered=ids[id]track['trackId']=alreadyRegistered['trackId']track['viperId']=alreadyRegistered['viperId']#track['attributes']['category'] = alreadyRegistered['attributes']['category']#track['artist']['name'] = alreadyRegistered['artist']['name']track['duration']['seconds']=alreadyRegistered['duration']['seconds']track['publishTime']['seconds']=alreadyRegistered['publishTime']['seconds']iftrack!=alreadyRegistered:print('different')print(track)print(alreadyRegistered)#break#print('Already in `ids`!')#breakelse:ids[id]=track
Computing MAXIMAL_NUMBER_OF_RESULTS
The updated algorithm initially published in 588b20409b5acc2e4412427ccd1d333847157400 is:
importos,jsonpath='/home/benjamin/Desktop/bens_folder/dev/yt/audio_library'os.chdir(path)withopen('music.json')asjson_file:tracks=json.load(json_file)mostResults=0mostResultsTitle=Nonefortrackintracks:title=track['title']results=0forotherTrackintracks:# Doesn't used to have `replace` and `lower`, but it seems that it is what YouTube UI title search does.title=title.replace('!','')iftitle.lower()inotherTrack['title'].lower():results+=1ifresults>mostResults:mostResults=resultsmostResultsTitle=titleprint(mostResults,mostResultsTitle)
Delete Page
Deleting the wiki page "Home" cannot be undone. Continue?