rembo10/headphones — pull request #1521 by basilfx (2014-04-04 17:56:04+00:00)
Title: Handle discographies and collections better

The post processor will first expand folder to detect subfolders containing media files. This assumes discographies have albums per directory, possibly with CD1/CD2 subfolders. If this algorithm is not able to expand subfolders, it will try to give an advice to the user.

For the examples below, I used a folder structure similar to this to:

```
- root/Muse (discography)/
- Absolution [2003]/
- HAARP [2008]/
- The Resistance (instrumental) []/
- Showbiz [1999]/
- Hullabaloo Soundtrack [2002]/
- CD1/
- CD2/
- Extras/
- Some extras/
- More extras/
- Some other extras/
```

Before this fix.
```
04-apr-2014 16:36:12 - INFO :: Thread-12 : Checking to see if there are any folders to process in download_dir(s): ['/Users/basilfx/Desktop/HeadphonesTest/downloads']
04-apr-2014 16:36:12 - INFO :: Thread-12 : Found 1 folders to process
04-apr-2014 16:36:12 - INFO :: Thread-12 : Processing: ACHMDGYMSdisc
04-apr-2014 16:36:12 - DEBUG :: Thread-12 : Attempting to find album in the snatched table
04-apr-2014 16:36:12 - DEBUG :: Thread-12 : Attempting to extract name, album and year from folder name
04-apr-2014 16:36:12 - DEBUG :: Thread-12 : Attempting to extract name, album and year from metadata
04-apr-2014 16:36:12 - INFO :: Thread-12 : Found 1 artists, 66 albums and 12 years in metadata, ignoring
04-apr-2014 16:36:12 - DEBUG :: Thread-12 : Attempting to extract release group from folder name
04-apr-2014 16:36:12 - INFO :: Thread-12 : Couldn't parse ACHMDGYMSdisc into any valid format. If adding albums from another source, they must be in an 'Artist - Album [Year]' format, or end with the musicbrainz release group id
```

After this fix, but it still fails because the assumption fails. It informs me to look at the 'Extras' folder.
```
04-apr-2014 18:50:56 - INFO :: Thread-12 : Checking to see if there are any folders to process in download_dir(s): ['/Users/basilfx/Desktop/HeadphonesTest/downloads']
04-apr-2014 18:50:56 - INFO :: Thread-12 : Found 76 media folders, but depth difference between lowest and deepest media folder is 3 (expected zero). If this is a discography or a collection of albums, make sure albums are per folder
04-apr-2014 18:50:56 - INFO :: Thread-12 : Please look at the following folder(s), since they cause the depth difference: ["/Users/basilfx/Desktop/HeadphonesTest/downloads/ACHMDGYMSdisc/Muse/Extra's in variabele bitrate"]
04-apr-2014 18:50:56 - INFO :: Thread-12 : Found 1 folders to process
04-apr-2014 18:50:56 - INFO :: Thread-12 : Processing: ACHMDGYMSdisc
04-apr-2014 18:50:56 - DEBUG :: Thread-12 : Attempting to find album in the snatched table
04-apr-2014 18:50:56 - DEBUG :: Thread-12 : Attempting to extract name, album and year from folder name
04-apr-2014 18:50:56 - DEBUG :: Thread-12 : Attempting to extract name, album and year from metadata
04-apr-2014 18:50:57 - INFO :: Thread-12 : Found 1 artists, 66 albums and 12 years in metadata, ignoring
04-apr-2014 18:50:57 - DEBUG :: Thread-12 : Attempting to extract release group from folder name
04-apr-2014 18:50:57 - INFO :: Thread-12 : Couldn't parse ACHMDGYMSdisc into any valid format. If adding albums from another source, they must be in an 'Artist - Album [Year]' format, or end with the musicbrainz release group id
```

After this fix, when I removed the 'Extras' folder, all goes well.
```
04-apr-2014 18:52:38 - INFO :: Thread-13 : Checking to see if there are any folders to process in download_dir(s): ['/Users/basilfx/Desktop/HeadphonesTest/downloads']
04-apr-2014 18:52:38 - INFO :: Thread-13 : Found 7 folders to process
04-apr-2014 18:52:38 - INFO :: Thread-13 : Processing: 2009 - Muse - The Resistance
04-apr-2014 18:52:38 - DEBUG :: Thread-13 : Attempting to find album in the snatched table
04-apr-2014 18:52:38 - DEBUG :: Thread-13 : Attempting to extract name, album and year from folder name
04-apr-2014 18:52:38 - DEBUG :: Thread-13 : Attempting to extract name, album and year from metadata
04-apr-2014 18:52:38 - INFO :: Thread-13 : Querying MusicBrainz for the release group id for: muse - the resistance
04-apr-2014 18:52:38 - INFO :: Thread-13 : Now adding/updating artist: Muse
04-apr-2014 18:52:38 - INFO :: Thread-13 : ArtistID: 9c9f1380-2516-4fc9-a3e6-f9f61941d090 , ArtistName: Muse
04-apr-2014 18:52:38 - INFO :: Thread-13 : Now adding album: The Resistance (instrumental)
04-apr-2014 18:52:38 - INFO :: Thread-13 : Addition complete for: The Resistance (instrumental) - Muse
04-apr-2014 18:52:38 - DEBUG :: Thread-13 : Verifying metadata...
...
...
04-apr-2014 18:53:14 - INFO :: Thread-13 : Checking which files we need to move.....
04-apr-2014 18:53:14 - INFO :: Thread-13 : Updating file permissions in /Users/basilfx/Desktop/HeadphonesTest/music/Muse/Showbiz [1999]
04-apr-2014 18:53:14 - INFO :: Thread-13 : Scanning music directory: /Users/basilfx/Desktop/HeadphonesTest/music/Muse/Showbiz [1999]
04-apr-2014 18:53:14 - INFO :: Thread-13 : 13 new/modified songs found and added to the database
04-apr-2014 18:53:14 - INFO :: Thread-13 : Found 13 new/modified tracks in: '/Users/basilfx/Desktop/HeadphonesTest/music/Muse/Showbiz [1999]'. Matching tracks to the appropriate releases....
04-apr-2014 18:53:14 - INFO :: Thread-13 : Now matching songs by Muse
04-apr-2014 18:53:14 - INFO :: Thread-13 : Track matching is 100.0% complete
04-apr-2014 18:53:14 - INFO :: Thread-13 : Completed matching tracks from directory: /Users/basilfx/Desktop/HeadphonesTest/music/Muse/Showbiz [1999]
04-apr-2014 18:53:14 - INFO :: Thread-13 : Updating artist track counts
04-apr-2014 18:53:14 - INFO :: Thread-13 : Counting matched tracks to mark albums as skipped/downloaded
04-apr-2014 18:53:14 - INFO :: Thread-13 : Album status update complete
04-apr-2014 18:53:14 - INFO :: Thread-13 : Library scan complete
04-apr-2014 18:53:14 - INFO :: Thread-13 : Post-processing for Muse - Showbiz complete
```

This probably fixes #608