void CGUIDialogVideoInfo::Play(bool resume) { if (!m_movieItem->GetVideoInfoTag()->m_strEpisodeGuide.IsEmpty()) { CStdString strPath; strPath.Format("videodb://2/2/%i/",m_movieItem->GetVideoInfoTag()->m_iDbId); Close(); g_windowManager.ActivateWindow(WINDOW_VIDEO_NAV,strPath); return; } CFileItem movie(*m_movieItem->GetVideoInfoTag()); if (m_movieItem->GetVideoInfoTag()->m_strFileNameAndPath.IsEmpty()) movie.SetPath(m_movieItem->GetPath()); CGUIWindowVideoNav* pWindow = (CGUIWindowVideoNav*)g_windowManager.GetWindow(WINDOW_VIDEO_NAV); if (pWindow) { // close our dialog Close(true); if (resume) movie.m_lStartOffset = STARTOFFSET_RESUME; else if (!CGUIWindowVideoBase::ShowResumeMenu(movie)) { // The Resume dialog was closed without any choice DoModal(); return; } pWindow->PlayMovie(&movie); } }
bool CGUIWindowMusicNav::OnContextButton(int itemNumber, CONTEXT_BUTTON button) { CFileItemPtr item; if (itemNumber >= 0 && itemNumber < m_vecItems->Size()) item = m_vecItems->Get(itemNumber); switch (button) { case CONTEXT_BUTTON_INFO: { if (!item->IsVideoDb()) return CGUIWindowMusicBase::OnContextButton(itemNumber,button); // music videos - artists if (item->GetPath().Left(14).Equals("videodb://3/4/")) { long idArtist = m_musicdatabase.GetArtistByName(item->GetLabel()); if (idArtist == -1) return false; CStdString path; path.Format("musicdb://2/%ld/", idArtist); item->SetPath(path); CGUIWindowMusicBase::OnContextButton(itemNumber,button); Update(m_vecItems->GetPath()); m_viewControl.SetSelectedItem(itemNumber); return true; } // music videos - albums if (item->GetPath().Left(14).Equals("videodb://3/5/")) { long idAlbum = m_musicdatabase.GetAlbumByName(item->GetLabel()); if (idAlbum == -1) return false; CStdString path; path.Format("musicdb://3/%ld/", idAlbum); item->SetPath(path); CGUIWindowMusicBase::OnContextButton(itemNumber,button); Update(m_vecItems->GetPath()); m_viewControl.SetSelectedItem(itemNumber); return true; } if (item->HasVideoInfoTag() && !item->GetVideoInfoTag()->m_strTitle.IsEmpty()) { CGUIWindowVideoNav* pWindow = (CGUIWindowVideoNav*)g_windowManager.GetWindow(WINDOW_VIDEO_NAV); if (pWindow) { ADDON::ScraperPtr info; pWindow->OnInfo(item.get(),info); Update(m_vecItems->GetPath()); } } return true; } case CONTEXT_BUTTON_INFO_ALL: OnInfoAll(itemNumber); return true; case CONTEXT_BUTTON_UPDATE_LIBRARY: { CGUIDialogMusicScan *scanner = (CGUIDialogMusicScan *)g_windowManager.GetWindow(WINDOW_DIALOG_MUSIC_SCAN); if (scanner) scanner->StartScanning(""); return true; } case CONTEXT_BUTTON_SET_DEFAULT: g_settings.m_defaultMusicLibSource = GetQuickpathName(item->GetPath()); g_settings.Save(); return true; case CONTEXT_BUTTON_CLEAR_DEFAULT: g_settings.m_defaultMusicLibSource.Empty(); g_settings.Save(); return true; case CONTEXT_BUTTON_GO_TO_ARTIST: { CStdString strPath; CVideoDatabase database; database.Open(); strPath.Format("videodb://3/4/%ld/",database.GetMatchingMusicVideo(item->GetMusicInfoTag()->GetArtist())); g_windowManager.ActivateWindow(WINDOW_VIDEO_NAV,strPath); return true; } case CONTEXT_BUTTON_PLAY_OTHER: { CVideoDatabase database; database.Open(); CVideoInfoTag details; database.GetMusicVideoInfo("",details,database.GetMatchingMusicVideo(item->GetMusicInfoTag()->GetArtist(),item->GetMusicInfoTag()->GetAlbum(),item->GetMusicInfoTag()->GetTitle())); g_application.getApplicationMessenger().PlayFile(CFileItem(details)); return true; } case CONTEXT_BUTTON_MARK_WATCHED: CGUIWindowVideoBase::MarkWatched(item,true); CUtil::DeleteVideoDatabaseDirectoryCache(); Update(m_vecItems->GetPath()); return true; case CONTEXT_BUTTON_MARK_UNWATCHED: CGUIWindowVideoBase::MarkWatched(item,false); CUtil::DeleteVideoDatabaseDirectoryCache(); Update(m_vecItems->GetPath()); return true; case CONTEXT_BUTTON_RENAME: CGUIWindowVideoBase::UpdateVideoTitle(item.get()); CUtil::DeleteVideoDatabaseDirectoryCache(); Update(m_vecItems->GetPath()); return true; case CONTEXT_BUTTON_DELETE: if (item->IsPlayList() || item->IsSmartPlayList()) { item->m_bIsFolder = false; CFileUtils::DeleteItem(item); } else { CGUIWindowVideoNav::DeleteItem(item.get()); CUtil::DeleteVideoDatabaseDirectoryCache(); } Update(m_vecItems->GetPath()); return true; case CONTEXT_BUTTON_SET_CONTENT: { bool bScan=false; ADDON::ScraperPtr scraper; CStdString path(item->GetPath()); CQueryParams params; CDirectoryNode::GetDatabaseInfo(item->GetPath(), params); CONTENT_TYPE content = CONTENT_ALBUMS; if (params.GetAlbumId() != -1) path.Format("musicdb://3/%i/",params.GetAlbumId()); else if (params.GetArtistId() != -1) { path.Format("musicdb://2/%i/",params.GetArtistId()); content = CONTENT_ARTISTS; } if (m_vecItems->GetPath().Equals("musicdb://1/") || item->GetPath().Equals("musicdb://2/")) { content = CONTENT_ARTISTS; } if (!m_musicdatabase.GetScraperForPath(path, scraper, ADDON::ScraperTypeFromContent(content))) { ADDON::AddonPtr defaultScraper; if (ADDON::CAddonMgr::Get().GetDefault(ADDON::ScraperTypeFromContent(content), defaultScraper)) { scraper = boost::dynamic_pointer_cast<ADDON::CScraper>(defaultScraper->Clone(defaultScraper)); } } if (CGUIDialogContentSettings::Show(scraper, bScan, content)) { m_musicdatabase.SetScraperForPath(path,scraper); if (bScan) OnInfoAll(itemNumber,true); } return true; } default: break; } return CGUIWindowMusicBase::OnContextButton(itemNumber, button); }
bool CGUIWindowMusicNav::OnContextButton(int itemNumber, CONTEXT_BUTTON button) { CFileItemPtr item; if (itemNumber >= 0 && itemNumber < m_vecItems->Size()) item = m_vecItems->Get(itemNumber); switch (button) { case CONTEXT_BUTTON_INFO: { if (!item->IsVideoDb()) return CGUIWindowMusicBase::OnContextButton(itemNumber,button); // music videos - artists if (StringUtils::StartsWithNoCase(item->GetPath(), "videodb://musicvideos/artists/")) { long idArtist = m_musicdatabase.GetArtistByName(item->GetLabel()); if (idArtist == -1) return false; CStdString path = StringUtils::Format("musicdb://artists/%ld/", idArtist); CArtist artist; m_musicdatabase.GetArtistInfo(idArtist,artist,false); *item = CFileItem(artist); item->SetPath(path); CGUIWindowMusicBase::OnContextButton(itemNumber,button); Refresh(); m_viewControl.SetSelectedItem(itemNumber); return true; } // music videos - albums if (StringUtils::StartsWithNoCase(item->GetPath(), "videodb://musicvideos/albums/")) { long idAlbum = m_musicdatabase.GetAlbumByName(item->GetLabel()); if (idAlbum == -1) return false; CStdString path = StringUtils::Format("musicdb://albums/%ld/", idAlbum); CAlbum album; m_musicdatabase.GetAlbumInfo(idAlbum,album,NULL); *item = CFileItem(path,album); item->SetPath(path); CGUIWindowMusicBase::OnContextButton(itemNumber,button); Refresh(); m_viewControl.SetSelectedItem(itemNumber); return true; } if (item->HasVideoInfoTag() && !item->GetVideoInfoTag()->m_strTitle.empty()) { CGUIWindowVideoNav* pWindow = (CGUIWindowVideoNav*)g_windowManager.GetWindow(WINDOW_VIDEO_NAV); if (pWindow) { ADDON::ScraperPtr info; pWindow->OnInfo(item.get(),info); Refresh(); } } return true; } case CONTEXT_BUTTON_INFO_ALL: OnInfoAll(itemNumber); return true; case CONTEXT_BUTTON_SET_DEFAULT: CSettings::Get().SetString("mymusic.defaultlibview", GetQuickpathName(item->GetPath())); CSettings::Get().Save(); return true; case CONTEXT_BUTTON_CLEAR_DEFAULT: CSettings::Get().SetString("mymusic.defaultlibview", ""); CSettings::Get().Save(); return true; case CONTEXT_BUTTON_GO_TO_ARTIST: { CStdString strPath; CVideoDatabase database; database.Open(); strPath = StringUtils::Format("videodb://musicvideos/artists/%ld/", database.GetMatchingMusicVideo(StringUtils::Join(item->GetMusicInfoTag()->GetArtist(), g_advancedSettings.m_musicItemSeparator))); g_windowManager.ActivateWindow(WINDOW_VIDEO_NAV,strPath); return true; } case CONTEXT_BUTTON_PLAY_OTHER: { CVideoDatabase database; database.Open(); CVideoInfoTag details; database.GetMusicVideoInfo("",details,database.GetMatchingMusicVideo(StringUtils::Join(item->GetMusicInfoTag()->GetArtist(), g_advancedSettings.m_musicItemSeparator),item->GetMusicInfoTag()->GetAlbum(),item->GetMusicInfoTag()->GetTitle())); CApplicationMessenger::Get().PlayFile(CFileItem(details)); return true; } case CONTEXT_BUTTON_MARK_WATCHED: CGUIDialogVideoInfo::MarkWatched(item, true); CUtil::DeleteVideoDatabaseDirectoryCache(); Refresh(); return true; case CONTEXT_BUTTON_MARK_UNWATCHED: CGUIDialogVideoInfo::MarkWatched(item, false); CUtil::DeleteVideoDatabaseDirectoryCache(); Refresh(); return true; case CONTEXT_BUTTON_RENAME: CGUIDialogVideoInfo::UpdateVideoItemTitle(item); CUtil::DeleteVideoDatabaseDirectoryCache(); Refresh(); return true; case CONTEXT_BUTTON_DELETE: if (item->IsPlayList() || item->IsSmartPlayList()) { item->m_bIsFolder = false; CFileUtils::DeleteItem(item); } else { CGUIDialogVideoInfo::DeleteVideoItemFromDatabase(item); CUtil::DeleteVideoDatabaseDirectoryCache(); } Refresh(); return true; case CONTEXT_BUTTON_SET_CONTENT: { ADDON::ScraperPtr scraper; CStdString path(item->GetPath()); CQueryParams params; CDirectoryNode::GetDatabaseInfo(item->GetPath(), params); CONTENT_TYPE content = CONTENT_ALBUMS; if (params.GetAlbumId() != -1) path = StringUtils::Format("musicdb://albums/%i/",params.GetAlbumId()); else if (params.GetArtistId() != -1) { path = StringUtils::Format("musicdb://artists/%i/",params.GetArtistId()); content = CONTENT_ARTISTS; } if (m_vecItems->GetPath().Equals("musicdb://genres/") || item->GetPath().Equals("musicdb://artists/")) { content = CONTENT_ARTISTS; } if (!m_musicdatabase.GetScraperForPath(path, scraper, ADDON::ScraperTypeFromContent(content))) { ADDON::AddonPtr defaultScraper; if (ADDON::CAddonMgr::Get().GetDefault(ADDON::ScraperTypeFromContent(content), defaultScraper)) { scraper = boost::dynamic_pointer_cast<ADDON::CScraper>(defaultScraper->Clone()); } } if (CGUIDialogContentSettings::Show(scraper, content)) { m_musicdatabase.SetScraperForPath(path,scraper); if (CGUIDialogYesNo::ShowAndGetInput(20442,20443,20444,20022)) { OnInfoAll(itemNumber,true,true); } } return true; } default: break; } return CGUIWindowMusicBase::OnContextButton(itemNumber, button); }
bool CGUIWindowMusicNav::OnContextButton(int itemNumber, CONTEXT_BUTTON button) { switch (button) { case CONTEXT_BUTTON_INFO: { if (!m_vecItems->Get(itemNumber)->IsVideoDb()) return CGUIWindowMusicBase::OnContextButton(itemNumber,button); if (m_vecItems->Get(itemNumber)->m_strPath.Left(14).Equals("videodb://3/4/")) { long idArtist = m_musicdatabase.GetArtistByName(m_vecItems->Get(itemNumber)->GetLabel()); if (idArtist == -1) return false; m_vecItems->Get(itemNumber)->m_strPath.Format("musicdb://2/%ld/", m_musicdatabase.GetArtistByName(m_vecItems->Get(itemNumber)->GetLabel())); CGUIWindowMusicBase::OnContextButton(itemNumber,button); Update(m_vecItems->m_strPath); m_viewControl.SetSelectedItem(itemNumber); return true; } CGUIWindowVideoNav* pWindow = (CGUIWindowVideoNav*)m_gWindowManager.GetWindow(WINDOW_VIDEO_NAV); if (pWindow) { SScraperInfo info; pWindow->OnInfo(m_vecItems->Get(itemNumber),info); Update(m_vecItems->m_strPath); } return true; } case CONTEXT_BUTTON_INFO_ALL: OnInfoAll(itemNumber); return true; case CONTEXT_BUTTON_SET_ARTIST_THUMB: case CONTEXT_BUTTON_SET_PLUGIN_THUMB: SetThumb(itemNumber, button); return true; case CONTEXT_BUTTON_UPDATE_LIBRARY: { CGUIDialogMusicScan *scanner = (CGUIDialogMusicScan *)m_gWindowManager.GetWindow(WINDOW_DIALOG_MUSIC_SCAN); if (scanner) scanner->StartScanning(""); return true; } case CONTEXT_BUTTON_SET_DEFAULT: g_settings.m_defaultMusicLibSource = GetQuickpathName(m_vecItems->Get(itemNumber)->m_strPath); g_settings.Save(); return true; case CONTEXT_BUTTON_CLEAR_DEFAULT: g_settings.m_defaultMusicLibSource.Empty(); g_settings.Save(); return true; case CONTEXT_BUTTON_GO_TO_ARTIST: { CStdString strPath; CVideoDatabase database; database.Open(); strPath.Format("videodb://3/4/%ld/",database.GetMusicVideoArtistByName(m_vecItems->Get(itemNumber)->GetMusicInfoTag()->GetArtist())); m_gWindowManager.ActivateWindow(WINDOW_VIDEO_NAV,strPath); return true; } case CONTEXT_BUTTON_PLAY_OTHER: { CVideoDatabase database; database.Open(); CVideoInfoTag details; database.GetMusicVideoInfo("",details,database.GetMusicVideoByArtistAndAlbumAndTitle(m_vecItems->Get(itemNumber)->GetMusicInfoTag()->GetArtist(),m_vecItems->Get(itemNumber)->GetMusicInfoTag()->GetAlbum(),m_vecItems->Get(itemNumber)->GetMusicInfoTag()->GetTitle())); g_application.getApplicationMessenger().PlayFile(CFileItem(details)); return true; } case CONTEXT_BUTTON_MARK_WATCHED: CGUIWindowVideoBase::MarkWatched(m_vecItems->Get(itemNumber)); CUtil::DeleteVideoDatabaseDirectoryCache(); Update(m_vecItems->m_strPath); return true; case CONTEXT_BUTTON_MARK_UNWATCHED: CGUIWindowVideoBase::MarkUnWatched(m_vecItems->Get(itemNumber)); CUtil::DeleteVideoDatabaseDirectoryCache(); Update(m_vecItems->m_strPath); return true; case CONTEXT_BUTTON_RENAME: CGUIWindowVideoBase::UpdateVideoTitle(m_vecItems->Get(itemNumber)); CUtil::DeleteVideoDatabaseDirectoryCache(); Update(m_vecItems->m_strPath); return true; case CONTEXT_BUTTON_DELETE: CGUIWindowVideoNav::DeleteItem(m_vecItems->Get(itemNumber)); CUtil::DeleteVideoDatabaseDirectoryCache(); Update(m_vecItems->m_strPath); return true; case CONTEXT_BUTTON_SET_CONTENT: { bool bScan=false; SScraperInfo info; if (!m_musicdatabase.GetScraperForPath(m_vecItems->Get(itemNumber)->m_strPath,info)) info.strContent = "albums"; int iLabel=132; // per genre or for all artists if (m_vecItems->m_strPath.Equals("musicdb://1/") || m_vecItems->Get(itemNumber)->m_strPath.Equals("musicdb://2/")) { iLabel = 133; } if (CGUIDialogContentSettings::Show(info, bScan,iLabel)) { m_musicdatabase.SetScraperForPath(m_vecItems->Get(itemNumber)->m_strPath,info); if (bScan) OnInfoAll(itemNumber,true); } return true; } default: break; } return CGUIWindowMusicBase::OnContextButton(itemNumber, button); }