{"action":"created","issue":{"url":"https://api.github.com/repos/xbmc/xbmc/issues/6810","labels_url":"https://api.github.com/repos/xbmc/xbmc/issues/6810/labels{/name}","comments_url":"https://api.github.com/repos/xbmc/xbmc/issues/6810/comments","events_url":"https://api.github.com/repos/xbmc/xbmc/issues/6810/events","html_url":"https://github.com/xbmc/xbmc/pull/6810","id":64124667,"number":6810,"title":"musicdb: cleanup detection of Singles","user":{"login":"Montellese","id":75864,"avatar_url":"https://avatars.githubusercontent.com/u/75864?v=3","gravatar_id":"","url":"https://api.github.com/users/Montellese","html_url":"https://github.com/Montellese","followers_url":"https://api.github.com/users/Montellese/followers","following_url":"https://api.github.com/users/Montellese/following{/other_user}","gists_url":"https://api.github.com/users/Montellese/gists{/gist_id}","starred_url":"https://api.github.com/users/Montellese/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Montellese/subscriptions","organizations_url":"https://api.github.com/users/Montellese/orgs","repos_url":"https://api.github.com/users/Montellese/repos","events_url":"https://api.github.com/users/Montellese/events{/privacy}","received_events_url":"https://api.github.com/users/Montellese/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/xbmc/xbmc/labels/API%20change","name":"API change","color":"02d7e1"},{"url":"https://api.github.com/repos/xbmc/xbmc/labels/Cleanup","name":"Cleanup","color":"DDDDDD"},{"url":"https://api.github.com/repos/xbmc/xbmc/labels/Improvement","name":"Improvement","color":"0b02e1"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-03-24T23:15:53Z","updated_at":"2015-03-26T09:26:54Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/xbmc/xbmc/pulls/6810","html_url":"https://github.com/xbmc/xbmc/pull/6810","diff_url":"https://github.com/xbmc/xbmc/pull/6810.diff","patch_url":"https://github.com/xbmc/xbmc/pull/6810.patch"},"body":"Right now we use the condition that an album with an empty title is considered a single and not a real album in multiple places in the code and it's not really standardized or obvious. Furthermore the decision whether an album is actually a single is not done when adding data to the database but rather when retrieving it from the database. I find that a very odd concept.\r\n\r\nTherefore I have added a new enumeration `CAlbum::ReleaseType` which can either be `Album` or `Single` and there are methods to translate these to/from strings. Then I've added members of this type to `CAlbum` and `CMusicInfoTag` so that we can easily detect the difference. Last but not least I have added a new column `strReleaseType` to the `album` table which can either be `\"album\"` or `\"single\"`. With that we can now do more explicit checks for and distinction between albums and singles which should make the code a bit easier to understand.\r\n\r\nFurthermore it allows to better integrate this information into JSON-RPC by providing a `releasetype` / `albumreleasetype` property for albums / songs and a `includesingles` paramter for `AudioLibrary.GetAlbums`.\r\n\r\nThere is one code place in `CMusicDatabase` which retrieves singles when retrieving all albums for an artist but doesn't retrieve singles when not retrieving the albums of a specific artist which I don't like either. IMO the caller should specify whether to retrieve albums including singles or not. But it's difficult to track down all the calls that implicitly use this logic so I didn't touch it for now."},"comment":{"url":"https://api.github.com/repos/xbmc/xbmc/issues/comments/86419244","html_url":"https://github.com/xbmc/xbmc/pull/6810#issuecomment-86419244","issue_url":"https://api.github.com/repos/xbmc/xbmc/issues/6810","id":86419244,"user":{"login":"Montellese","id":75864,"avatar_url":"https://avatars.githubusercontent.com/u/75864?v=3","gravatar_id":"","url":"https://api.github.com/users/Montellese","html_url":"https://github.com/Montellese","followers_url":"https://api.github.com/users/Montellese/followers","following_url":"https://api.github.com/users/Montellese/following{/other_user}","gists_url":"https://api.github.com/users/Montellese/gists{/gist_id}","starred_url":"https://api.github.com/users/Montellese/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Montellese/subscriptions","organizations_url":"https://api.github.com/users/Montellese/orgs","repos_url":"https://api.github.com/users/Montellese/repos","events_url":"https://api.github.com/users/Montellese/events{/privacy}","received_events_url":"https://api.github.com/users/Montellese/received_events","type":"User","site_admin":false},"created_at":"2015-03-26T09:26:54Z","updated_at":"2015-03-26T09:26:54Z","body":"`releasetype` and `albumreleasetype` don't require any additional SQL querying so the query shouldn't get slower.\r\n\r\nIMO adding a boolean for every release type is not really good design and will result in duplicate information in the API.\r\n\r\nLike I said I'm not very knowledgeable in the music area but from the implementation in Kodi it looks like compilation is a different thing than the difference between \"album\" and \"single\" as a compilation is also an album and the \"only\" difference is that there's no album artist."}}