From cb1fc7d8e2c0ba18373356088b076250d9f1f05e Mon Sep 17 00:00:00 2001 From: Nicolas Pomepuy Date: Mon, 16 Sep 2024 11:40:54 +0200 Subject: [PATCH] Refactor the artist/album APi methods --- .../videolan/television/ui/MainTvFragment.kt | 2 +- .../television/ui/MediaItemDetailsFragment.kt | 2 +- .../java/org/videolan/television/ui/TvUtil.kt | 2 +- .../television/ui/details/MediaListAdapter.kt | 2 +- .../television/viewmodel/MainTvModel.kt | 6 +-- .../src/org/videolan/vlc/PlaybackService.kt | 4 +- .../vlc/gui/HeaderMediaListActivity.kt | 4 +- .../vlc/gui/audio/BaseAudioBrowser.kt | 6 +-- .../org/videolan/vlc/gui/helpers/AudioUtil.kt | 4 +- .../vlc/gui/helpers/PlayerOptionsDelegate.kt | 8 +-- .../videolan/vlc/gui/helpers/TalkbackUtil.kt | 6 +-- .../videolan/vlc/media/MediaSessionBrowser.kt | 4 +- .../src/org/videolan/vlc/media/MediaUtils.kt | 10 ++-- .../org/videolan/vlc/media/PlaylistManager.kt | 8 +-- .../src/org/videolan/vlc/util/ModelsHelper.kt | 12 ++--- .../vlc/widget/MiniPlayerAppWidgetProvider.kt | 4 +- .../vlc/webserver/RemoteAccessRouting.kt | 2 +- .../vlc/webserver/RemoteAccessServer.kt | 4 +- medialibrary/jni/utils.cpp | 2 +- .../src/org/videolan/medialibrary/Tools.java | 2 +- .../interfaces/media/MediaWrapper.java | 52 +++++++++---------- .../medialibrary/media/MediaWrapperImpl.java | 26 +++++----- .../medialibrary/stubs/StubAlbum.java | 10 ++-- .../medialibrary/stubs/StubArtist.java | 24 ++++----- .../medialibrary/stubs/StubDataSource.java | 18 +++---- .../medialibrary/stubs/StubGenre.java | 10 ++-- .../medialibrary/stubs/StubMediaWrapper.java | 6 +-- 27 files changed, 120 insertions(+), 120 deletions(-) diff --git a/application/television/src/main/java/org/videolan/television/ui/MainTvFragment.kt b/application/television/src/main/java/org/videolan/television/ui/MainTvFragment.kt index 02ec22075..3a5a68907 100644 --- a/application/television/src/main/java/org/videolan/television/ui/MainTvFragment.kt +++ b/application/television/src/main/java/org/videolan/television/ui/MainTvFragment.kt @@ -351,7 +351,7 @@ class MainTvFragment : BrowseSupportFragment(), OnItemViewSelectedListener, OnIt val intent = Intent(requireActivity(), DetailsActivity::class.java) // pass the item information intent.putExtra(EXTRA_MEDIA, media) - intent.putExtra(EXTRA_ITEM, MediaItemDetails(media.title, media.artist, media.album, media.location, media.artworkURL)) + intent.putExtra(EXTRA_ITEM, MediaItemDetails(media.title, media.artistName, media.albumName, media.location, media.artworkURL)) startActivity(intent) return true } diff --git a/application/television/src/main/java/org/videolan/television/ui/MediaItemDetailsFragment.kt b/application/television/src/main/java/org/videolan/television/ui/MediaItemDetailsFragment.kt index aee8cd877..1e42e5a9c 100644 --- a/application/television/src/main/java/org/videolan/television/ui/MediaItemDetailsFragment.kt +++ b/application/television/src/main/java/org/videolan/television/ui/MediaItemDetailsFragment.kt @@ -152,7 +152,7 @@ class MediaItemDetailsFragment : DetailsSupportFragment(), CoroutineScope by Mai viewModel.browserFavUpdated.observe(this, Observer { newMedia -> val intent = Intent(requireActivity(), DetailsActivity::class.java) intent.putExtra(org.videolan.television.ui.EXTRA_MEDIA, newMedia) - intent.putExtra(EXTRA_ITEM, MediaItemDetails(newMedia.title, newMedia.artist, newMedia.album, newMedia.location, newMedia.artworkURL)) + intent.putExtra(EXTRA_ITEM, MediaItemDetails(newMedia.title, newMedia.artistName, newMedia.albumName, newMedia.location, newMedia.artworkURL)) startActivity(intent) requireActivity().finish() }) diff --git a/application/television/src/main/java/org/videolan/television/ui/TvUtil.kt b/application/television/src/main/java/org/videolan/television/ui/TvUtil.kt index be7aade84..3a598dc9f 100644 --- a/application/television/src/main/java/org/videolan/television/ui/TvUtil.kt +++ b/application/television/src/main/java/org/videolan/television/ui/TvUtil.kt @@ -253,7 +253,7 @@ object TvUtil { fun showMediaDetail(activity: Context, mediaWrapper: MediaWrapper, fromHistory:Boolean = false) { val intent = Intent(activity, DetailsActivity::class.java) intent.putExtra("media", mediaWrapper) - intent.putExtra("item", MediaItemDetails(mediaWrapper.title, mediaWrapper.artist, mediaWrapper.album, mediaWrapper.location, mediaWrapper.artworkURL)) + intent.putExtra("item", MediaItemDetails(mediaWrapper.title, mediaWrapper.artistName, mediaWrapper.albumName, mediaWrapper.location, mediaWrapper.artworkURL)) if (fromHistory) intent.putExtra(EXTRA_FROM_HISTORY, fromHistory) activity.startActivity(intent) } diff --git a/application/television/src/main/java/org/videolan/television/ui/details/MediaListAdapter.kt b/application/television/src/main/java/org/videolan/television/ui/details/MediaListAdapter.kt index 1858faaf4..98bbadbae 100644 --- a/application/television/src/main/java/org/videolan/television/ui/details/MediaListAdapter.kt +++ b/application/television/src/main/java/org/videolan/television/ui/details/MediaListAdapter.kt @@ -42,7 +42,7 @@ class MediaListAdapter(private val type: Int, private val listener: ITVEventsHan val item = getItem(position) holder.binding.item = item holder.binding.holder = holder - holder.binding.subtitle = if (item.getDiscNumberString() != null) "${item.artist} · ${item.getDiscNumberString()}" else item.artist + holder.binding.subtitle = if (item.getDiscNumberString() != null) "${item.artistName} · ${item.getDiscNumberString()}" else item.artistName val moveVisibility = if (type == MediaLibraryItem.TYPE_ALBUM) View.GONE else View.VISIBLE holder.binding.itemMoveDown.visibility = if (moveVisibility == View.VISIBLE && position == itemCount - 1) View.INVISIBLE else moveVisibility diff --git a/application/television/src/main/java/org/videolan/television/viewmodel/MainTvModel.kt b/application/television/src/main/java/org/videolan/television/viewmodel/MainTvModel.kt index a8c366787..bbc4164f5 100644 --- a/application/television/src/main/java/org/videolan/television/viewmodel/MainTvModel.kt +++ b/application/television/src/main/java/org/videolan/television/viewmodel/MainTvModel.kt @@ -194,9 +194,9 @@ class MainTvModel(app: Application) : AndroidViewModel(app), Medialibrary.OnMedi PlaybackService.instance?.run { currentMediaWrapper?.let { if (this.playlistManager.player.isVideoPlaying()) - DummyItem(CATEGORY_NOW_PLAYING_PIP, it.title, it.artist).apply { setArtWork(coverArt) } + DummyItem(CATEGORY_NOW_PLAYING_PIP, it.title, it.artistName).apply { setArtWork(coverArt) } else - DummyItem(CATEGORY_NOW_PLAYING, it.title, it.artist).apply { setArtWork(coverArt) } + DummyItem(CATEGORY_NOW_PLAYING, it.title, it.artistName).apply { setArtWork(coverArt) } } }?.let { list.add(0, it) } (nowPlaying as MutableLiveData).value = list @@ -315,7 +315,7 @@ class MainTvModel(app: Application) : AndroidViewModel(app), Medialibrary.OnMedi val intent = Intent(activity, org.videolan.television.ui.DetailsActivity::class.java) // pass the item information intent.putExtra("media", it) - intent.putExtra("item", org.videolan.television.ui.MediaItemDetails(it.title, it.artist, it.album, it.location, it.artworkURL)) + intent.putExtra("item", org.videolan.television.ui.MediaItemDetails(it.title, it.artistName, it.albumName, it.location, it.artworkURL)) activity.startActivity(intent) } } diff --git a/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt b/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt index 479e9bf16..f23027c3e 100644 --- a/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt +++ b/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt @@ -1015,8 +1015,8 @@ class PlaybackService : MediaBrowserServiceCompat(), LifecycleOwner, CoroutineSc if (isPlayingPopup || !notificationShowing) return@launch try { val title = if (metaData == null) mw.title else metaData.getString(MediaMetadataCompat.METADATA_KEY_TITLE) - val artist = if (metaData == null) mw.artist else metaData.getString(MediaMetadataCompat.METADATA_KEY_ALBUM_ARTIST) - val album = if (metaData == null) mw.album else metaData.getString(MediaMetadataCompat.METADATA_KEY_ALBUM) + val artist = if (metaData == null) mw.artistName else metaData.getString(MediaMetadataCompat.METADATA_KEY_ALBUM_ARTIST) + val album = if (metaData == null) mw.albumName else metaData.getString(MediaMetadataCompat.METADATA_KEY_ALBUM) var cover = if (coverOnLockscreen && metaData != null) metaData.getBitmap(MediaMetadataCompat.METADATA_KEY_ALBUM_ART) else null if (coverOnLockscreen && cover == null) diff --git a/application/vlc-android/src/org/videolan/vlc/gui/HeaderMediaListActivity.kt b/application/vlc-android/src/org/videolan/vlc/gui/HeaderMediaListActivity.kt index 068a5ad59..f883e5887 100644 --- a/application/vlc-android/src/org/videolan/vlc/gui/HeaderMediaListActivity.kt +++ b/application/vlc-android/src/org/videolan/vlc/gui/HeaderMediaListActivity.kt @@ -507,7 +507,7 @@ open class HeaderMediaListActivity : AudioPlayerContainerActivity(), IEventsHand } CTX_ADD_SHORTCUT -> lifecycleScope.launch { createShortcut(media) } CTX_GO_TO_ARTIST -> lifecycleScope.launch(Dispatchers.IO) { - val artist = if (media is Album) media.retrieveAlbumArtist() else (media as MediaWrapper).getArtistWrapper() + val artist = if (media is Album) media.retrieveAlbumArtist() else (media as MediaWrapper).artist val i = Intent(this@HeaderMediaListActivity, SecondaryActivity::class.java) i.putExtra(SecondaryActivity.KEY_FRAGMENT, SecondaryActivity.ALBUMS_SONGS) i.putExtra(AudioBrowserFragment.TAG_ITEM, artist) @@ -516,7 +516,7 @@ open class HeaderMediaListActivity : AudioPlayerContainerActivity(), IEventsHand startActivity(i) } CTX_GO_TO_ALBUM_ARTIST -> lifecycleScope.launch(Dispatchers.IO) { - val artist = (media as MediaWrapper).getAlbumArtistWrapper() + val artist = (media as MediaWrapper).albumArtist val i = Intent(this@HeaderMediaListActivity, SecondaryActivity::class.java) i.putExtra(SecondaryActivity.KEY_FRAGMENT, SecondaryActivity.ALBUMS_SONGS) i.putExtra(AudioBrowserFragment.TAG_ITEM, artist) diff --git a/application/vlc-android/src/org/videolan/vlc/gui/audio/BaseAudioBrowser.kt b/application/vlc-android/src/org/videolan/vlc/gui/audio/BaseAudioBrowser.kt index d852bea93..4a14042ab 100644 --- a/application/vlc-android/src/org/videolan/vlc/gui/audio/BaseAudioBrowser.kt +++ b/application/vlc-android/src/org/videolan/vlc/gui/audio/BaseAudioBrowser.kt @@ -450,11 +450,11 @@ abstract class BaseAudioBrowser : MediaBrowserFragmen CTX_INFORMATION -> showInfoDialog(media) CTX_GO_TO_ALBUM -> lifecycleScope.launch(Dispatchers.IO) { val i = Intent(activity, HeaderMediaListActivity::class.java) - i.putExtra(AudioBrowserFragment.TAG_ITEM, (media as MediaWrapper).getAlbumWrapper()) + i.putExtra(AudioBrowserFragment.TAG_ITEM, (media as MediaWrapper).album) startActivity(i) } CTX_GO_TO_ARTIST -> lifecycleScope.launch(Dispatchers.IO) { - val artist = if (media is Album) media.retrieveAlbumArtist() else (media as MediaWrapper).getArtistWrapper() + val artist = if (media is Album) media.retrieveAlbumArtist() else (media as MediaWrapper).artist val i = Intent(requireActivity(), SecondaryActivity::class.java) i.putExtra(SecondaryActivity.KEY_FRAGMENT, SecondaryActivity.ALBUMS_SONGS) i.putExtra(AudioBrowserFragment.TAG_ITEM, artist) @@ -463,7 +463,7 @@ abstract class BaseAudioBrowser : MediaBrowserFragmen startActivity(i) } CTX_GO_TO_ALBUM_ARTIST -> lifecycleScope.launch(Dispatchers.IO) { - val artist = (media as MediaWrapper).getAlbumArtistWrapper() + val artist = (media as MediaWrapper).albumArtist val i = Intent(requireActivity(), SecondaryActivity::class.java) i.putExtra(SecondaryActivity.KEY_FRAGMENT, SecondaryActivity.ALBUMS_SONGS) i.putExtra(AudioBrowserFragment.TAG_ITEM, artist) diff --git a/application/vlc-android/src/org/videolan/vlc/gui/helpers/AudioUtil.kt b/application/vlc-android/src/org/videolan/vlc/gui/helpers/AudioUtil.kt index bd6500abf..caa7219f8 100644 --- a/application/vlc-android/src/org/videolan/vlc/gui/helpers/AudioUtil.kt +++ b/application/vlc-android/src/org/videolan/vlc/gui/helpers/AudioUtil.kt @@ -74,7 +74,7 @@ object AudioUtil { val values = contentValuesOf( MediaStore.MediaColumns.TITLE to song.title, MediaStore.MediaColumns.MIME_TYPE to type, - MediaStore.Audio.Media.ARTIST to song.artist, + MediaStore.Audio.Media.ARTIST to song.artistName, MediaStore.Audio.Media.IS_RINGTONE to true, MediaStore.Audio.Media.IS_NOTIFICATION to false, MediaStore.Audio.Media.IS_ALARM to false, @@ -130,7 +130,7 @@ object AudioUtil { } private fun getCoverFromMediaStore(context: Context, media: MediaWrapper): String? { - val album = media.album ?: return null + val album = media.albumName ?: return null val contentResolver = context.contentResolver val uri = MediaStore.Audio.Albums.EXTERNAL_CONTENT_URI val cursor = contentResolver.query(uri, arrayOf(MediaStore.Audio.Albums.ALBUM, MediaStore.Audio.Albums.ALBUM_ART), diff --git a/application/vlc-android/src/org/videolan/vlc/gui/helpers/PlayerOptionsDelegate.kt b/application/vlc-android/src/org/videolan/vlc/gui/helpers/PlayerOptionsDelegate.kt index 448febd54..0d4901630 100644 --- a/application/vlc-android/src/org/videolan/vlc/gui/helpers/PlayerOptionsDelegate.kt +++ b/application/vlc-android/src/org/videolan/vlc/gui/helpers/PlayerOptionsDelegate.kt @@ -266,14 +266,14 @@ class PlayerOptionsDelegate(val activity: FragmentActivity, val service: Playbac append(media.title) started = true } - if (media.album.isNotBlank()) { + if (media.albumName.isNotBlank()) { if (started) append(" ${TextUtils.separator} ") started = true - append(media.album) + append(media.albumName) } - if (media.artist.isNotBlank()) { + if (media.artistName.isNotBlank()) { if (started) append(" ${TextUtils.separator} ") - append(media.artist) + append(media.artistName) } } activity.share("", activity.getString(R.string.share_track, trackInfo)) diff --git a/application/vlc-android/src/org/videolan/vlc/gui/helpers/TalkbackUtil.kt b/application/vlc-android/src/org/videolan/vlc/gui/helpers/TalkbackUtil.kt index 5dc79d301..322cb27ef 100644 --- a/application/vlc-android/src/org/videolan/vlc/gui/helpers/TalkbackUtil.kt +++ b/application/vlc-android/src/org/videolan/vlc/gui/helpers/TalkbackUtil.kt @@ -46,8 +46,8 @@ object TalkbackUtil { fun getAudioTrack(context: Context, audio: MediaWrapper) = context.getString(R.string.talkback_audio_track, audio.title) .talkbackAppend(getDuration(context, millisToString(context, audio.length))) - .talkbackAppend(context.getString(R.string.talkback_album, audio.album)) - .talkbackAppend(context.getString(R.string.talkback_artist, audio.artist)) + .talkbackAppend(context.getString(R.string.talkback_album, audio.albumName)) + .talkbackAppend(context.getString(R.string.talkback_artist, audio.artistName)) fun getVideoGroup(context: Context, video: VideoGroup) = context.getString(R.string.talkback_video_group, video.title) .talkbackAppend(context.resources.getQuantityString(R.plurals.videos_quantity, video.mediaCount(), video.mediaCount())) @@ -68,7 +68,7 @@ object TalkbackUtil { fun getArtist(context: Context, artist: String?) = if (artist == null) "" else context.getString(R.string.talkback_artist, artist) fun getTrackNumber(context: Context, item: MediaWrapper) = context.getString(R.string.talkback_track_number, item.trackNumber.toString()) fun getTimeAndArtist(context: Context, item: MediaWrapper) = millisToString(context, item.length) - .talkbackAppend(getArtist(context, item.artist)) + .talkbackAppend(getArtist(context, item.artistName)) fun getFolder(context: Context, folder: Folder): String { diff --git a/application/vlc-android/src/org/videolan/vlc/media/MediaSessionBrowser.kt b/application/vlc-android/src/org/videolan/vlc/media/MediaSessionBrowser.kt index 6d813b8d9..d0836f862 100644 --- a/application/vlc-android/src/org/videolan/vlc/media/MediaSessionBrowser.kt +++ b/application/vlc-android/src/org/videolan/vlc/media/MediaSessionBrowser.kt @@ -419,11 +419,11 @@ class MediaSessionBrowser { val albumNames = mutableSetOf() if (Settings.getInstance(context).getBoolean(PLAYBACK_HISTORY, true)) { val lastMediaPlayed = ml.history(Medialibrary.HISTORY_TYPE_LOCAL)?.toList()?.filter { isMediaAudio(it) } - if (!lastMediaPlayed.isNullOrEmpty()) for (mw in lastMediaPlayed) mw.album?.let { albumNames.add(it) } + if (!lastMediaPlayed.isNullOrEmpty()) for (mw in lastMediaPlayed) mw.albumName?.let { albumNames.add(it) } } /* Pad the end with recently added albums. We may end up dropping a few due to absent artwork. */ val recentAudio = ml.getPagedAudio(Medialibrary.SORT_INSERTIONDATE, true, false, false, MAX_HISTORY_SIZE, 0) - if (!recentAudio.isNullOrEmpty()) for (mw in recentAudio) mw.album?.let { albumNames.add(it) } + if (!recentAudio.isNullOrEmpty()) for (mw in recentAudio) mw.albumName?.let { albumNames.add(it) } /* Build the list of media items */ val results: ArrayList = ArrayList() val shuffleAllPath = Uri.Builder() diff --git a/application/vlc-android/src/org/videolan/vlc/media/MediaUtils.kt b/application/vlc-android/src/org/videolan/vlc/media/MediaUtils.kt index 8d12f79f6..73ee8998d 100644 --- a/application/vlc-android/src/org/videolan/vlc/media/MediaUtils.kt +++ b/application/vlc-android/src/org/videolan/vlc/media/MediaUtils.kt @@ -299,7 +299,7 @@ object MediaUtils { fun getMediaArtist(ctx: Context, media: MediaWrapper?): String = when { media == null -> getMediaString(ctx, R.string.unknown_artist) media.type == MediaWrapper.TYPE_VIDEO -> "" - media.artist != null -> media.artist + media.artistName != null -> media.artistName media.nowPlaying != null -> media.title isSchemeStreaming(media.uri.scheme) -> "" else -> getMediaString(ctx, R.string.unknown_artist) @@ -307,12 +307,12 @@ object MediaUtils { fun getMediaReferenceArtist(ctx: Context, media: MediaWrapper?) = getMediaArtist(ctx, media) - fun getMediaAlbumArtist(ctx: Context, media: MediaWrapper?) = media?.albumArtist + fun getMediaAlbumArtist(ctx: Context, media: MediaWrapper?) = media?.albumArtistName ?: getMediaString(ctx, R.string.unknown_artist) fun getMediaAlbum(ctx: Context, media: MediaWrapper?): String = when { media == null -> getMediaString(ctx, R.string.unknown_album) - media.album != null -> media.album + media.albumName != null -> media.albumName media.nowPlaying != null -> "" isSchemeStreaming(media.uri.scheme) -> "" else -> getMediaString(ctx, R.string.unknown_album) @@ -329,9 +329,9 @@ object MediaUtils { } val suffix = when { media.type == MediaWrapper.TYPE_VIDEO -> generateResolutionClass(media.width, media.height) - media.length > 0L -> media.artist + media.length > 0L -> media.artistName isSchemeStreaming(media.uri.scheme) -> media.uri.toString() - else -> media.artist + else -> media.artistName } return TextUtils.separatedString(prefix, suffix) } diff --git a/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt b/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt index fb78e2f4a..2eb1a1d52 100644 --- a/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt +++ b/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt @@ -760,7 +760,7 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList if (!isAudio && saveVideoPlayQueue) { settings.putSingle(KEY_CURRENT_MEDIA_RESUME, media.location) settings.putSingle(KEY_CURRENT_AUDIO_RESUME_TITLE, media.title ?: "") - settings.putSingle(KEY_CURRENT_AUDIO_RESUME_ARTIST, media.artist ?: "") + settings.putSingle(KEY_CURRENT_AUDIO_RESUME_ARTIST, media.artistName ?: "") settings.putSingle(KEY_CURRENT_AUDIO_RESUME_THUMB, media.artworkURL ?: "") settings.putSingle(KEY_CURRENT_MEDIA, media.location) } @@ -768,7 +768,7 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList settings.putSingle(KEY_CURRENT_MEDIA_RESUME, media.location) settings.putSingle(KEY_CURRENT_AUDIO, media.location) settings.putSingle(KEY_CURRENT_AUDIO_RESUME_TITLE, media.title ?: "") - settings.putSingle(KEY_CURRENT_AUDIO_RESUME_ARTIST, media.artist ?: "") + settings.putSingle(KEY_CURRENT_AUDIO_RESUME_ARTIST, media.artistName ?: "") settings.putSingle(KEY_CURRENT_AUDIO_RESUME_THUMB, media.artworkURL ?: "") } } @@ -1151,7 +1151,7 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList newMedia = false if (player.hasRenderer || !player.isVideoPlaying()) showAudioPlayer.value = true savePlaycount(mw) - if (mw.title == mw.fileName || (mw.type == MediaWrapper.TYPE_STREAM && (mw.title != player.mediaplayer.media?.getMeta(IMedia.Meta.Title, true) || mw.artist != player.mediaplayer.media?.getMeta(IMedia.Meta.Artist, true)))) { + if (mw.title == mw.fileName || (mw.type == MediaWrapper.TYPE_STREAM && (mw.title != player.mediaplayer.media?.getMeta(IMedia.Meta.Title, true) || mw.artistName != player.mediaplayer.media?.getMeta(IMedia.Meta.Artist, true)))) { // used for initial metadata update. We avoid the metadata load when the initial MediaPlayer.Event.ESSelected is sent to avoid race conditions refreshTrackMeta(mw) } @@ -1215,7 +1215,7 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList MediaPlayer.Event.ESSelected -> { getCurrentMedia()?.let { media -> if (player.isPlaying()) { - if (media.type == MediaWrapper.TYPE_STREAM && (media.title != player.mediaplayer.media?.getMeta(IMedia.Meta.Title, true) || media.artist != player.mediaplayer.media?.getMeta(IMedia.Meta.Artist, true))) { + if (media.type == MediaWrapper.TYPE_STREAM && (media.title != player.mediaplayer.media?.getMeta(IMedia.Meta.Title, true) || media.artistName != player.mediaplayer.media?.getMeta(IMedia.Meta.Artist, true))) { refreshTrackMeta(media) } } diff --git a/application/vlc-android/src/org/videolan/vlc/util/ModelsHelper.kt b/application/vlc-android/src/org/videolan/vlc/util/ModelsHelper.kt index a787e47b7..ffb484e1f 100644 --- a/application/vlc-android/src/org/videolan/vlc/util/ModelsHelper.kt +++ b/application/vlc-android/src/org/videolan/vlc/util/ModelsHelper.kt @@ -75,7 +75,7 @@ object ModelsHelper { var currentArtist: String? = null for (item in items) { if (item.itemType == MediaLibraryItem.TYPE_DUMMY) continue - val artist = (item as MediaWrapper).artist ?: "" + val artist = (item as MediaWrapper).artistName ?: "" if (currentArtist === null || currentArtist != artist) { currentArtist = artist if (array[currentArtist].isNullOrEmpty()) array[currentArtist] = mutableListOf() @@ -87,7 +87,7 @@ object ModelsHelper { var currentAlbum: String? = null for (item in items) { if (item.itemType == MediaLibraryItem.TYPE_DUMMY) continue - val album = (item as MediaWrapper).album ?: "" + val album = (item as MediaWrapper).albumName ?: "" if (currentAlbum === null || currentAlbum != album) { currentAlbum = album if (array[currentAlbum].isNullOrEmpty()) array[currentAlbum] = mutableListOf() @@ -165,18 +165,18 @@ object ModelsHelper { } else null } SORT_ARTIST -> { - val artist = (item as? MediaWrapper)?.artist ?: (item as? Album)?.albumArtist ?: "" + val artist = (item as? MediaWrapper)?.artistName ?: (item as? Album)?.albumArtist ?: "" if (aboveItem == null) artist else { - val previous = (aboveItem as? MediaWrapper)?.artist ?: (aboveItem as? Album)?.albumArtist ?: "" + val previous = (aboveItem as? MediaWrapper)?.artistName ?: (aboveItem as? Album)?.albumArtist ?: "" artist.takeIf { it != previous } } } SORT_ALBUM -> { - val album = (item as MediaWrapper).album ?: "" + val album = (item as MediaWrapper).albumName ?: "" if (aboveItem == null) album else { - val previous = (aboveItem as MediaWrapper).album ?: "" + val previous = (aboveItem as MediaWrapper).albumName ?: "" album.takeIf { it != previous } } } diff --git a/application/vlc-android/src/org/videolan/vlc/widget/MiniPlayerAppWidgetProvider.kt b/application/vlc-android/src/org/videolan/vlc/widget/MiniPlayerAppWidgetProvider.kt index 8179debad..e879514f6 100644 --- a/application/vlc-android/src/org/videolan/vlc/widget/MiniPlayerAppWidgetProvider.kt +++ b/application/vlc-android/src/org/videolan/vlc/widget/MiniPlayerAppWidgetProvider.kt @@ -268,8 +268,8 @@ class MiniPlayerAppWidgetProvider : AppWidgetProvider() { } val artist = when { - forPreview -> widgetCacheEntry.currentMedia?.artist - playing -> service?.artist ?: widgetCacheEntry.currentMedia?.artist + forPreview -> widgetCacheEntry.currentMedia?.artistName + playing -> service?.artist ?: widgetCacheEntry.currentMedia?.artistName else -> settings.getString(KEY_CURRENT_AUDIO_RESUME_ARTIST, "") } setupTexts(context, views, widgetType, title, artist) diff --git a/application/webserver/src/main/java/org/videolan/vlc/webserver/RemoteAccessRouting.kt b/application/webserver/src/main/java/org/videolan/vlc/webserver/RemoteAccessRouting.kt index a87becc3b..febaca1c4 100644 --- a/application/webserver/src/main/java/org/videolan/vlc/webserver/RemoteAccessRouting.kt +++ b/application/webserver/src/main/java/org/videolan/vlc/webserver/RemoteAccessRouting.kt @@ -1529,7 +1529,7 @@ fun Genre.toPlayQueueItem(appContext: Context) = RemoteAccessServer.PlayQueueIte fun Playlist.toPlayQueueItem(appContext: Context) = RemoteAccessServer.PlayQueueItem(id, title, appContext.resources.getQuantityString(R.plurals.track_quantity, tracksCount, tracksCount), 0, artworkMrl ?: "", false, "", favorite = isFavorite) -fun MediaWrapper.toPlayQueueItem(defaultArtist: String = "") = RemoteAccessServer.PlayQueueItem(id, title, artist?.ifEmpty { defaultArtist } ?: defaultArtist, length, artworkMrl +fun MediaWrapper.toPlayQueueItem(defaultArtist: String = "") = RemoteAccessServer.PlayQueueItem(id, title, artistName?.ifEmpty { defaultArtist } ?: defaultArtist, length, artworkMrl ?: "", false, generateResolutionClass(width, height) ?: "", progress = time, played = seen > 0, favorite = isFavorite) fun Folder.toPlayQueueItem(context: Context) = RemoteAccessServer.PlayQueueItem(id, title, context.resources.getQuantityString(org.videolan.vlc.R.plurals.videos_quantity, mediaCount(Folder.TYPE_FOLDER_VIDEO), mediaCount(Folder.TYPE_FOLDER_VIDEO)) diff --git a/application/webserver/src/main/java/org/videolan/vlc/webserver/RemoteAccessServer.kt b/application/webserver/src/main/java/org/videolan/vlc/webserver/RemoteAccessServer.kt index e355d416c..9a01275bd 100644 --- a/application/webserver/src/main/java/org/videolan/vlc/webserver/RemoteAccessServer.kt +++ b/application/webserver/src/main/java/org/videolan/vlc/webserver/RemoteAccessServer.kt @@ -604,7 +604,7 @@ class RemoteAccessServer(private val context: Context) : PlaybackService.Callbac val isVideoPlaying = service.playlistManager.player.isVideoPlaying() val waitForMediaEnd = service.waitForMediaEnd val resetOnInteraction = service.resetOnInteraction - val nowPlaying = NowPlaying(media.title ?: "", media.artist + val nowPlaying = NowPlaying(media.title ?: "", media.artistName ?: "", service.isPlaying, isVideoPlaying, service.getTime(), service.length, media.id, media.artworkURL ?: "", media.uri.toString(), getVolume(), speed, sleepTimer, waitForMediaEnd, resetOnInteraction, service.isShuffling, service.repeatType, bookmarks = bookmarks.map { WSBookmark(it.id, it.title, it.time) }, chapters = chapters.map { WSChapter(it.name, it.duration) }) return nowPlaying @@ -623,7 +623,7 @@ class RemoteAccessServer(private val context: Context) : PlaybackService.Callbac service?.let { service -> val list = ArrayList() service.playlistManager.getMediaList().forEachIndexed { index, mediaWrapper -> - list.add(PlayQueueItem(mediaWrapper.id, mediaWrapper.title, mediaWrapper.artist + list.add(PlayQueueItem(mediaWrapper.id, mediaWrapper.title, mediaWrapper.artistName ?: "", mediaWrapper.length, mediaWrapper.artworkMrl ?: "", service.playlistManager.currentIndex == index, favorite = mediaWrapper.isFavorite)) } diff --git a/medialibrary/jni/utils.cpp b/medialibrary/jni/utils.cpp index c50da0f86..67df84de9 100644 --- a/medialibrary/jni/utils.cpp +++ b/medialibrary/jni/utils.cpp @@ -75,7 +75,7 @@ mediaToMediaWrapper(JNIEnv* env, fields *fields, medialibrary::MediaPtr const& m auto isFavorite = mediaPtr->isFavorite(); return { env, env->NewObject(fields->MediaWrapper.clazz, fields->MediaWrapper.initID, (jlong) mediaPtr->id(), mrl.get(), (jlong) mediaPtr->lastTime(), (jfloat) mediaPtr->lastPosition(), (jlong) duration, type, - title.get(), filename.get(), (jlong) artistId, albumArtistId, artist.get(), genre.get(), (jlong) albumId, album.get(), + title.get(), filename.get(), (jlong) artistId, (jlong) albumArtistId, artist.get(), genre.get(), (jlong) albumId, album.get(), albumArtist.get(), width, height, thumbnail.get(), audioTrack, spuTrack, trackNumber, discNumber, (jlong) files.at(0)->lastModificationDate(), (jlong) mediaPtr->playCount(), hasThumbnail, isFavorite, mediaPtr->releaseDate(), isPresent, (jlong) mediaPtr->insertionDate()) diff --git a/medialibrary/src/org/videolan/medialibrary/Tools.java b/medialibrary/src/org/videolan/medialibrary/Tools.java index 7c91be6c1..ceefce84c 100644 --- a/medialibrary/src/org/videolan/medialibrary/Tools.java +++ b/medialibrary/src/org/videolan/medialibrary/Tools.java @@ -93,7 +93,7 @@ public class Tools { if (hasprogress) sb.append(progress); else sb.append(Tools.millisToString(mw.getLength())); item.setDescription(sb.toString()); } else if (mw.getType() == MediaWrapper.TYPE_AUDIO) { - final String artist = mw.getReferenceArtist(), album = mw.getAlbum(); + final String artist = mw.getReferenceArtist(), album = mw.getAlbumName(); final StringBuilder sb = new StringBuilder(); boolean hasArtist = !TextUtils.isEmpty(artist), hasAlbum = !TextUtils.isEmpty(album); if (hasArtist && hasAlbum) sb.append(artist).append(" - ").append(album); diff --git a/medialibrary/src/org/videolan/medialibrary/interfaces/media/MediaWrapper.java b/medialibrary/src/org/videolan/medialibrary/interfaces/media/MediaWrapper.java index a005b731a..65df75bed 100644 --- a/medialibrary/src/org/videolan/medialibrary/interfaces/media/MediaWrapper.java +++ b/medialibrary/src/org/videolan/medialibrary/interfaces/media/MediaWrapper.java @@ -93,14 +93,14 @@ public abstract class MediaWrapper extends MediaLibraryItem implements Parcelabl protected String mDisplayTitle; protected long mArtistId; protected long mAlbumArtistId; - protected String mArtist; + protected String mArtistName; protected String mGenre; protected String mCopyright; protected long mAlbumId; - protected String mAlbum; + protected String mAlbumName; protected int mTrackNumber; protected int mDiscNumber; - protected String mAlbumArtist; + protected String mAlbumArtistName; protected String mRating; protected String mDate; protected int mReleaseYear; @@ -151,9 +151,9 @@ public abstract class MediaWrapper extends MediaLibraryItem implements Parcelabl public abstract boolean removeBookmark(long time); public abstract boolean removeAllBookmarks(); public abstract boolean markAsPlayed(); - public abstract Album getAlbumWrapper(); - public abstract Artist getArtistWrapper(); - public abstract Artist getAlbumArtistWrapper(); + public abstract Album getAlbum(); + public abstract Artist getArtist(); + public abstract Artist getAlbumArtist(); /** * Create a new MediaWrapper @@ -339,11 +339,11 @@ public abstract class MediaWrapper extends MediaLibraryItem implements Parcelabl mTitle = title != null ? title.trim() : null; mArtistId = artistId; mAlbumArtistId = albumArtistId; - mArtist = artist != null ? artist.trim() : null; + mArtistName = artist != null ? artist.trim() : null; mGenre = genre != null ? genre.trim() : null; mAlbumId = albumId; - mAlbum = album != null ? album.trim() : null; - mAlbumArtist = albumArtist != null ? albumArtist.trim() : null; + mAlbumName = album != null ? album.trim() : null; + mAlbumArtistName = albumArtist != null ? albumArtist.trim() : null; mArtworkURL = artworkURL; mTrackNumber = trackNumber; mDiscNumber = discNumber; @@ -426,10 +426,10 @@ public abstract class MediaWrapper extends MediaLibraryItem implements Parcelabl private void updateMeta(IMedia media) { mTitle = getMetaTitle(media); - mArtist = getMetaId(media, mArtist, Media.Meta.Artist, true); - mAlbum = getMetaId(media, mAlbum, Media.Meta.Album, true); + mArtistName = getMetaId(media, mArtistName, Media.Meta.Artist, true); + mAlbumName = getMetaId(media, mAlbumName, Media.Meta.Album, true); mGenre = getMetaId(media, mGenre, Media.Meta.Genre, true); - mAlbumArtist = getMetaId(media, mAlbumArtist, Media.Meta.AlbumArtist, true); + mAlbumArtistName = getMetaId(media, mAlbumArtistName, Media.Meta.AlbumArtist, true); mArtworkURL = getMetaId(media, mArtworkURL, Media.Meta.ArtworkURL, false); mNowPlaying = getMetaId(media, mNowPlaying, Media.Meta.NowPlaying, false); final String trackNumber = getMetaId(media, null, Media.Meta.TrackNumber, false); @@ -523,7 +523,7 @@ public abstract class MediaWrapper extends MediaLibraryItem implements Parcelabl public boolean isPodcast() { return mType == TYPE_AUDIO && (mLength > PODCAST_ABSOLUTE - || TextUtils.isEmpty(mAlbum) && mLength > PODCAST_THRESHOLD + || TextUtils.isEmpty(mAlbumName) && mLength > PODCAST_THRESHOLD || "podcast".equalsIgnoreCase(mGenre) || "audiobooks".equalsIgnoreCase(mGenre) || "audiobook".equalsIgnoreCase(mGenre) @@ -581,7 +581,7 @@ public abstract class MediaWrapper extends MediaLibraryItem implements Parcelabl public void setArtist(String artist) { - mArtist = artist; + mArtistName = artist; } @Override @@ -606,11 +606,11 @@ public abstract class MediaWrapper extends MediaLibraryItem implements Parcelabl } public String getReferenceArtist() { - return mAlbumArtist == null ? mArtist : mAlbumArtist; + return mAlbumArtistName == null ? mArtistName : mAlbumArtistName; } - public String getArtist() { - return mArtist; + public String getArtistName() { + return mArtistName; } public long getArtistId() { @@ -622,7 +622,7 @@ public abstract class MediaWrapper extends MediaLibraryItem implements Parcelabl } public Boolean isArtistUnknown() { - return mArtist == null; + return mArtistName == null; } public String getGenre() { @@ -642,16 +642,16 @@ public abstract class MediaWrapper extends MediaLibraryItem implements Parcelabl return mAlbumId; } - public String getAlbum() { - return mAlbum; + public String getAlbumName() { + return mAlbumName; } - public String getAlbumArtist() { - return mAlbumArtist; + public String getAlbumArtistName() { + return mAlbumArtistName; } public Boolean isAlbumUnknown() { - return mAlbum == null; + return mAlbumName == null; } public int getTrackNumber() { @@ -804,11 +804,11 @@ public abstract class MediaWrapper extends MediaLibraryItem implements Parcelabl dest.writeString(getTitle()); dest.writeLong(getArtistId()); dest.writeLong(getAlbumArtistId()); - dest.writeString(getArtist()); + dest.writeString(getArtistName()); dest.writeString(getGenre()); dest.writeLong(getAlbumId()); - dest.writeString(getAlbum()); - dest.writeString(getAlbumArtist()); + dest.writeString(getAlbumName()); + dest.writeString(getAlbumArtistName()); dest.writeInt(getWidth()); dest.writeInt(getHeight()); dest.writeString(getArtworkURL()); diff --git a/medialibrary/src/org/videolan/medialibrary/media/MediaWrapperImpl.java b/medialibrary/src/org/videolan/medialibrary/media/MediaWrapperImpl.java index c862d61f5..4e9bfaf6e 100644 --- a/medialibrary/src/org/videolan/medialibrary/media/MediaWrapperImpl.java +++ b/medialibrary/src/org/videolan/medialibrary/media/MediaWrapperImpl.java @@ -78,40 +78,40 @@ public class MediaWrapperImpl extends MediaWrapper { } @Override - public Album getAlbumWrapper() { + public Album getAlbum() { final Medialibrary ml = Medialibrary.getInstance(); if (ml.isInitiated()) return ml.getAlbum(mAlbumId); return null; } @Override - public Artist getArtistWrapper() { + public Artist getArtist() { final Medialibrary ml = Medialibrary.getInstance(); if (ml.isInitiated()) return ml.getArtist(mArtistId); return null; } @Override - public Artist getAlbumArtistWrapper() { + public Artist getAlbumArtist() { final Medialibrary ml = Medialibrary.getInstance(); if (ml.isInitiated()) return ml.getArtist(mAlbumArtistId); return null; } public void setArtist(String artist) { - mArtist = artist; + mArtistName = artist; } public String getReferenceArtist() { - return mAlbumArtist == null ? mArtist : mAlbumArtist; + return mAlbumArtistName == null ? mArtistName : mAlbumArtistName; } - public String getArtist() { - return mArtist; + public String getArtistName() { + return mArtistName; } public Boolean isArtistUnknown() { - return mArtist == null; + return mArtistName == null; } public String getGenre() { @@ -127,16 +127,16 @@ public class MediaWrapperImpl extends MediaWrapper { return mCopyright; } - public String getAlbum() { - return mAlbum; + public String getAlbumName() { + return mAlbumName; } - public String getAlbumArtist() { - return mAlbumArtist; + public String getAlbumArtistName() { + return mAlbumArtistName; } public Boolean isAlbumUnknown() { - return mAlbum == null; + return mAlbumName == null; } public int getTrackNumber() { diff --git a/medialibrary/src/org/videolan/medialibrary/stubs/StubAlbum.java b/medialibrary/src/org/videolan/medialibrary/stubs/StubAlbum.java index ff534c3ed..73d3fd917 100644 --- a/medialibrary/src/org/videolan/medialibrary/stubs/StubAlbum.java +++ b/medialibrary/src/org/videolan/medialibrary/stubs/StubAlbum.java @@ -25,7 +25,7 @@ public class StubAlbum extends Album { public int getRealTracksCount() { int count = 0; for (MediaWrapper media : dt.mAudioMediaWrappers) { - if (media.getAlbum().equals(this.getTitle())) count++; + if (media.getAlbumName().equals(this.getTitle())) count++; } return count; } @@ -38,8 +38,8 @@ public class StubAlbum extends Album { private ArrayList getAlbumTracks() { ArrayList results = new ArrayList<>(); for (MediaWrapper media : dt.mAudioMediaWrappers) { - if (media.getAlbum().equals(this.getTitle()) - && media.getAlbumArtist().equals(this.retrieveAlbumArtist().getTitle())) { + if (media.getAlbumName().equals(this.getTitle()) + && media.getAlbumArtistName().equals(this.retrieveAlbumArtist().getTitle())) { results.add(media); } } @@ -57,7 +57,7 @@ public class StubAlbum extends Album { public MediaWrapper[] searchTracks(String query, int sort, boolean desc, boolean includeMissing, boolean onlyFavorites, int nbItems, int offset) { ArrayList results = new ArrayList<>(); for (MediaWrapper media : dt.mAudioMediaWrappers) { - if (media.getAlbum().equals(this.getTitle()) || + if (media.getAlbumName().equals(this.getTitle()) || Tools.hasSubString(media.getTitle(), query)) { results.add(media); } @@ -68,7 +68,7 @@ public class StubAlbum extends Album { public int searchTracksCount(String query) { int count = 0; for (MediaWrapper media : dt.mAudioMediaWrappers) { - if (media.getAlbum().equals(this.getTitle()) || + if (media.getAlbumName().equals(this.getTitle()) || Tools.hasSubString(media.getTitle(), query)) { count++; } diff --git a/medialibrary/src/org/videolan/medialibrary/stubs/StubArtist.java b/medialibrary/src/org/videolan/medialibrary/stubs/StubArtist.java index 2e0ca981f..98e7fd5e5 100644 --- a/medialibrary/src/org/videolan/medialibrary/stubs/StubArtist.java +++ b/medialibrary/src/org/videolan/medialibrary/stubs/StubArtist.java @@ -25,8 +25,8 @@ public class StubArtist extends Artist { private ArrayList getAlbumNames() { ArrayList results = new ArrayList<>(); for (MediaWrapper media : getTracks()) { - if (!results.contains(media.getAlbum())) { - results.add(media.getAlbum()); + if (!results.contains(media.getAlbumName())) { + results.add(media.getAlbumName()); } } return results; @@ -79,8 +79,8 @@ public class StubArtist extends Artist { public int searchTracksCount(String query) { int count = 0; for (MediaWrapper media : dt.mAudioMediaWrappers) { - if (media.getArtist().equals(this.getTitle()) && - media.getAlbumArtist().equals(this.getTitle()) && + if (media.getArtistName().equals(this.getTitle()) && + media.getAlbumArtistName().equals(this.getTitle()) && Tools.hasSubString(media.getTitle(), query)) { count++; } @@ -91,8 +91,8 @@ public class StubArtist extends Artist { public MediaWrapper[] searchTracks(String query, int sort, boolean desc, boolean includeMissing, boolean onlyFavorites, int nbItems, int offset) { ArrayList results = new ArrayList<>(); for (MediaWrapper media : dt.mAudioMediaWrappers) { - if (media.getArtist().equals(this.getTitle()) && - media.getAlbumArtist().equals(this.getTitle()) && + if (media.getArtistName().equals(this.getTitle()) && + media.getAlbumArtistName().equals(this.getTitle()) && Tools.hasSubString(media.getTitle(), query)) { results.add(media); } @@ -103,8 +103,8 @@ public class StubArtist extends Artist { public MediaWrapper[] getTracks(int sort, boolean desc, boolean includeMissing, boolean onlyFavorites) { ArrayList results = new ArrayList<>(); for (MediaWrapper media : dt.mAudioMediaWrappers) { - if (media.getArtist().equals(this.getTitle()) || - media.getAlbumArtist().equals(this.getTitle())) { + if (media.getArtistName().equals(this.getTitle()) || + media.getAlbumArtistName().equals(this.getTitle())) { results.add(media); } } @@ -114,8 +114,8 @@ public class StubArtist extends Artist { public MediaWrapper[] getPagedTracks(int sort, boolean desc, boolean includeMissing, boolean onlyFavorites, int nbItems, int offset) { ArrayList results = new ArrayList<>(); for (MediaWrapper media : dt.mAudioMediaWrappers) { - if (media.getArtist().equals(this.getTitle()) || - media.getAlbumArtist().equals(this.getTitle())) { + if (media.getArtistName().equals(this.getTitle()) || + media.getAlbumArtistName().equals(this.getTitle())) { results.add(media); } } @@ -125,8 +125,8 @@ public class StubArtist extends Artist { public int getTracksCount() { int count = 0; for (MediaWrapper media : dt.mAudioMediaWrappers) { - if (media.getArtist().equals(this.getTitle()) && - media.getAlbumArtist().equals(this.getTitle())) { + if (media.getArtistName().equals(this.getTitle()) && + media.getAlbumArtistName().equals(this.getTitle())) { count++; } } diff --git a/medialibrary/src/org/videolan/medialibrary/stubs/StubDataSource.java b/medialibrary/src/org/videolan/medialibrary/stubs/StubDataSource.java index 98bf43a42..65cd2a45b 100644 --- a/medialibrary/src/org/videolan/medialibrary/stubs/StubDataSource.java +++ b/medialibrary/src/org/videolan/medialibrary/stubs/StubDataSource.java @@ -208,9 +208,9 @@ public class StubDataSource { case SORT_LASTMODIFICATIONDATE: return Long.valueOf(o1.getLastModified()).compareTo(o2.getLastModified()); case SORT_ARTIST: - return compareArtistStr(o1.getArtist(), o2.getArtist()); + return compareArtistStr(o1.getArtistName(), o2.getArtistName()); case SORT_ALBUM: - return compareAlbumStr(o1.getAlbum(), o2.getAlbum()); + return compareAlbumStr(o1.getAlbumName(), o2.getAlbumName()); default: return 0; } @@ -523,24 +523,24 @@ public class StubDataSource { private void addAudio(MediaWrapper media, String shortBio, int releaseYear, int trackTotal, String mrl) { addFolders(media); - String albumArtistName = getArtistName(media.getAlbumArtist(), media.getArtist()); + String albumArtistName = getArtistName(media.getAlbumArtistName(), media.getArtistName()); Artist albumArtist = getArtistFromName(albumArtistName); if (albumArtist == null) { albumArtist = MLServiceLocator.getAbstractArtist(getUUID(), albumArtistName, "", media.getArtworkMrl(), "", 0, trackTotal, trackTotal, false); addArtistSecure(albumArtist); } - if (media.getArtist().isEmpty()) { + if (media.getArtistName().isEmpty()) { media.setArtist(albumArtistName); - } else if (!media.getArtist().equals(albumArtistName)) { - Artist artist = getArtistFromName(media.getArtist()); + } else if (!media.getArtistName().equals(albumArtistName)) { + Artist artist = getArtistFromName(media.getArtistName()); if (artist == null) { - artist = MLServiceLocator.getAbstractArtist(getUUID(), media.getArtist(), + artist = MLServiceLocator.getAbstractArtist(getUUID(), media.getArtistName(), "", media.getArtworkMrl(), "", 1, trackTotal, trackTotal, false); addArtistSecure(artist); } } - String albumName = getAlbumName(media.getAlbum()); + String albumName = getAlbumName(media.getAlbumName()); Album album = getAlbumFromName(albumName, albumArtist.getId()); if (album == null) { album = MLServiceLocator.getAbstractAlbum(getUUID(), albumName, releaseYear, @@ -562,7 +562,7 @@ public class StubDataSource { media.getFileName(), -1L, -1L, - media.getArtist(), + media.getArtistName(), genre.getTitle(), -1L, album.getTitle(), diff --git a/medialibrary/src/org/videolan/medialibrary/stubs/StubGenre.java b/medialibrary/src/org/videolan/medialibrary/stubs/StubGenre.java index 04bcd1a81..5db538c09 100644 --- a/medialibrary/src/org/videolan/medialibrary/stubs/StubGenre.java +++ b/medialibrary/src/org/videolan/medialibrary/stubs/StubGenre.java @@ -23,7 +23,7 @@ public class StubGenre extends Genre { for (MediaWrapper media : dt.mAudioMediaWrappers) { if (media.getGenre().equals(this.getTitle())) { for (Album album : dt.mAlbums) { - if (album.getTitle().equals(media.getAlbum()) && + if (album.getTitle().equals(media.getAlbumName()) && !results.contains(album)) { results.add(album); } @@ -49,7 +49,7 @@ public class StubGenre extends Genre { if (media.getGenre().equals(this.getTitle()) && Tools.hasSubString(media.getTitle(), query)) { for (Album album : dt.mAlbums) { - if (album.getTitle().equals(media.getAlbum()) && + if (album.getTitle().equals(media.getAlbumName()) && !results.contains(album)) { results.add(album); } @@ -66,7 +66,7 @@ public class StubGenre extends Genre { if (media.getGenre().equals(this.getTitle()) && Tools.hasSubString(media.getTitle(), query)) { for (Album album : dt.mAlbums) { - if (album.getTitle().equals(media.getAlbum()) && + if (album.getTitle().equals(media.getAlbumName()) && !results.contains(album)) { results.add(album); } @@ -81,8 +81,8 @@ public class StubGenre extends Genre { for (MediaWrapper media : dt.mAudioMediaWrappers) { if (media.getGenre().equals(this.getTitle())) { for (Artist artist : dt.mArtists) { - if ((artist.getTitle().equals(media.getArtist()) || - artist.getTitle().equals(media.getAlbumArtist())) && + if ((artist.getTitle().equals(media.getArtistName()) || + artist.getTitle().equals(media.getAlbumArtistName())) && !results.contains(artist)) { results.add(artist); break; diff --git a/medialibrary/src/org/videolan/medialibrary/stubs/StubMediaWrapper.java b/medialibrary/src/org/videolan/medialibrary/stubs/StubMediaWrapper.java index ecc50c037..169bcd71e 100644 --- a/medialibrary/src/org/videolan/medialibrary/stubs/StubMediaWrapper.java +++ b/medialibrary/src/org/videolan/medialibrary/stubs/StubMediaWrapper.java @@ -94,17 +94,17 @@ public class StubMediaWrapper extends MediaWrapper { } @Override - public Album getAlbumWrapper() { + public Album getAlbum() { return null; } @Override - public Artist getArtistWrapper() { + public Artist getArtist() { return null; } @Override - public Artist getAlbumArtistWrapper() { + public Artist getAlbumArtist() { return null; }