{"action":"created","issue":{"url":"https://api.github.com/repos/xbmc/xbmc/issues/9205","repository_url":"https://api.github.com/repos/xbmc/xbmc","labels_url":"https://api.github.com/repos/xbmc/xbmc/issues/9205/labels{/name}","comments_url":"https://api.github.com/repos/xbmc/xbmc/issues/9205/comments","events_url":"https://api.github.com/repos/xbmc/xbmc/issues/9205/events","html_url":"https://github.com/xbmc/xbmc/pull/9205","id":136350862,"number":9205,"title":"Ensure all songs and albums have an artist","user":{"login":"DaveTBlake","id":13371422,"avatar_url":"https://avatars.githubusercontent.com/u/13371422?v=3","gravatar_id":"","url":"https://api.github.com/users/DaveTBlake","html_url":"https://github.com/DaveTBlake","followers_url":"https://api.github.com/users/DaveTBlake/followers","following_url":"https://api.github.com/users/DaveTBlake/following{/other_user}","gists_url":"https://api.github.com/users/DaveTBlake/gists{/gist_id}","starred_url":"https://api.github.com/users/DaveTBlake/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DaveTBlake/subscriptions","organizations_url":"https://api.github.com/users/DaveTBlake/orgs","repos_url":"https://api.github.com/users/DaveTBlake/repos","events_url":"https://api.github.com/users/DaveTBlake/events{/privacy}","received_events_url":"https://api.github.com/users/DaveTBlake/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/xbmc/xbmc/labels/Database","name":"Database","color":"009800"},{"url":"https://api.github.com/repos/xbmc/xbmc/labels/Improvement","name":"Improvement","color":"0b02e1"},{"url":"https://api.github.com/repos/xbmc/xbmc/labels/JSON-RPC%20API%20Change","name":"JSON-RPC API Change","color":"e11d21"},{"url":"https://api.github.com/repos/xbmc/xbmc/labels/Music","name":"Music","color":"009800"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/xbmc/xbmc/milestones/74","html_url":"https://github.com/xbmc/xbmc/milestones/Krypton%2017.0-alpha1","labels_url":"https://api.github.com/repos/xbmc/xbmc/milestones/74/labels","id":1444499,"number":74,"title":"Krypton 17.0-alpha1","description":"","creator":{"login":"MartijnKaijser","id":907436,"avatar_url":"https://avatars.githubusercontent.com/u/907436?v=3","gravatar_id":"","url":"https://api.github.com/users/MartijnKaijser","html_url":"https://github.com/MartijnKaijser","followers_url":"https://api.github.com/users/MartijnKaijser/followers","following_url":"https://api.github.com/users/MartijnKaijser/following{/other_user}","gists_url":"https://api.github.com/users/MartijnKaijser/gists{/gist_id}","starred_url":"https://api.github.com/users/MartijnKaijser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MartijnKaijser/subscriptions","organizations_url":"https://api.github.com/users/MartijnKaijser/orgs","repos_url":"https://api.github.com/users/MartijnKaijser/repos","events_url":"https://api.github.com/users/MartijnKaijser/events{/privacy}","received_events_url":"https://api.github.com/users/MartijnKaijser/received_events","type":"User","site_admin":false},"open_issues":7,"closed_issues":563,"state":"open","created_at":"2015-12-04T16:31:06Z","updated_at":"2016-03-10T16:03:03Z","due_on":"2016-03-30T22:00:00Z","closed_at":null},"comments":53,"created_at":"2016-02-25T10:53:17Z","updated_at":"2016-03-10T19:25:32Z","closed_at":"2016-03-10T16:01:51Z","pull_request":{"url":"https://api.github.com/repos/xbmc/xbmc/pulls/9205","html_url":"https://github.com/xbmc/xbmc/pull/9205","diff_url":"https://github.com/xbmc/xbmc/pull/9205.diff","patch_url":"https://github.com/xbmc/xbmc/pull/9205.patch"},"body":"Until now it has been possible to have songs and albums in the music library that don't have an artist. It is the result of scanning music files that do not have an ARTIST/TPE1 tag. Many users will have artists for every song because they have tagged their music fully, but missing artist can still happen accidentally.\r\n\r\nThere are 2 issues with this:\r\n\r\n1) All queries wanting song or album and their artist(s) have to be left joins. Unfortunately there is a weakness in the SQLite optimiser that means that left joins onto views are not optimised and run horribly slowly. The work around currently implemented is to replace all the views in left joins with the explicit fields and tables, but it is not as easy to maintain or read. See #9081 for more discussion.\r\n\r\n2) Songs without artists are hidden in the UI. They do not get listed in a Genre -> Artist -> Album -> song approach. Only the songs node, listing all the songs, would show them somewhere in the potentially 1000s of other songs.\r\n\r\nFrom a data view point in makes a lot of sense for Kodi to collect all songs without an artist tag under a single invented  \"missing tag\" artist. This would mean that we can use more efficient inner joins in queries, but also that the \"missing tag\" artist would appear in the artist node and reveal those previously lost songs to the user, encouraging them to correct the tagging.\r\n\r\nA verbose discussion is on the forum http://forum.kodi.tv/showthread.php?tid=260165\r\nFollowing that I have adopted the approach that the invented \"missing tag\" artist  being unique and different from any other artist that could be scanned from music file tags, using a fake musicbrainz id. The name of the \"missing tag\" artist displayed by Kodi comes from the **current** language settings, the artist table being updated every scan of a file with a missing artist tag, and on library update.\r\n\r\nWhile there I have improved the indexes on song_artist table.\r\n\r\n@phate89 and @Razzeee as follow up from previous PR. \r\n@Tolriq I have not made any attempt to extend the JSON API with this PR. I am still waiting for feedback from @Montellese on earlier work, so perhaps it is better to do the API changes in a separate PR? I understand that the API needs to expose which artist is the invented \"missing tag\" one so that consumers can treat it in a special way if they want, but despite discussion I am unclear on the best way to do this. As it is where previously API was returning empty \"artist\" and \"artistid\" fields it will return values for both mixed in with all the other artists, so as it is this does not break the API.\r\n"},"comment":{"url":"https://api.github.com/repos/xbmc/xbmc/issues/comments/195009326","html_url":"https://github.com/xbmc/xbmc/pull/9205#issuecomment-195009326","issue_url":"https://api.github.com/repos/xbmc/xbmc/issues/9205","id":195009326,"user":{"login":"MilhouseVH","id":805038,"avatar_url":"https://avatars.githubusercontent.com/u/805038?v=3","gravatar_id":"","url":"https://api.github.com/users/MilhouseVH","html_url":"https://github.com/MilhouseVH","followers_url":"https://api.github.com/users/MilhouseVH/followers","following_url":"https://api.github.com/users/MilhouseVH/following{/other_user}","gists_url":"https://api.github.com/users/MilhouseVH/gists{/gist_id}","starred_url":"https://api.github.com/users/MilhouseVH/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MilhouseVH/subscriptions","organizations_url":"https://api.github.com/users/MilhouseVH/orgs","repos_url":"https://api.github.com/users/MilhouseVH/repos","events_url":"https://api.github.com/users/MilhouseVH/events{/privacy}","received_events_url":"https://api.github.com/users/MilhouseVH/received_events","type":"User","site_admin":false},"created_at":"2016-03-10T19:25:32Z","updated_at":"2016-03-10T19:25:32Z","body":"I'm pretty sure SQLite supports the same syntax as MySQL - see here for existing code that drops an index: https://github.com/xbmc/xbmc/blob/master/xbmc/video/VideoDatabase.cpp#L4805"}}