l3uddz / plex_dupefinder

Find and delete duplicate files in Plex
GNU General Public License v3.0
303 stars 54 forks source link

Add language as important criteria #51

Open jkoenig72 opened 3 years ago

jkoenig72 commented 3 years ago

Describe the problem Compare / list language and make it available for auto delete

Describe any solutions you think might work

Something like that might work... important is "item.reload()", otherwise AudioStream info is not provided. ...

loop returned duplicates

    for item in dupes:
        item.reload()
        languages = []
        for media in item.media:
            #print(media)
            for part in media.parts:
                #print(part)
                for stream in part.streams:
                    if type(stream) is plexapi.media.AudioStream:
                        #print(type(stream))
                        #print(stream, end=', ')
                        #print(stream.codec , end=', ')
                        #print(stream.languageCode)
                        languages.append(stream.languageCode)

....

        elif 'languages' in k:
            tmp.append(parts[item_id][k])

...

#add language to score
if 'ger' in media_info["languages"]:
    score+=20000

...

Additional context Nice tool you have created. FInd it very useful...

snickers2k commented 3 years ago

would be great i "rely" on German DL (dual-language) with english as second and i can't use dupefinder as long it prefers single audio