Hello, I like to save the average Bitrate (for lossy) or the bitdeth-samplerate (for lossless) Audio Files in the folder name. In addition I’m saving multic cd albums in a structure like Albumname/CD* - CD name [Bitrate or Bitdepth-samplerate].
But I have one album where CD1 is in FLAC and CD2 is in MP3 and there I noticed that the bitrate is calculated over the complete album. I have absolutely no clue how I should do that, because there are just that two options for album_fields an item_fields.
What I want is:
/ArtistEx/AlbumExample (2CD)/CD01 [FLAC 16-44]
/ArtistEx/AlbumExample (2CD)/CD02 [MP3 320kbps]
What I get is:
/ArtistEx/AlbumExample (2CD)/CD01 [FLAC 16-44]
/ArtistEx/AlbumExample (2CD)/CD02 [MP3 700kbps]
The CD with the MP3 just has 320kbps, but the average is generated over the whole album, including the FLACs. But I want that the average is generated only from the CD. Is this possible?
This is my actual Code:
total = 0 for item in items: total += item.bitrate bitrate = str(round(total / len(items) / 1000)) kbps = "kbps" return bitrate + kbps
I had an idea to make something with the item.disc parameter, but I don’t know how and what.
So the question: Is this possible to do that as I want and if yes, any suggestions?
******* EDIT ********
Ok I’ve got a lazy “solution”.
total = 0 itemCount = 0 for item in items: if item.bitrate < 400000: total += item.bitrate itemCount+=1 bitrate = str(round(total / itemCount / 1000)) kbps = "kbps" return bitrate + kbps
Now before I use the bitrate for calculating, I’m checking if the bitrate is higher then 400kbps and then dividing it with the count of the used objects. This solves my problem there the lossless files get calculated in the average too.
But this solution is not really clean. If there is an album with CD1@320kbps and CD2€128kbps it will still calculate the average for both CDs. So my question for get the average for the files in just one CD folder is still present.