Ejemplo n.º 1
0
bool UPnpCDSVideo::LoadMetadata(const UPnpCDSRequest* pRequest,
                                 UPnpCDSExtensionResults* pResults,
                                 IDTokenMap tokens, QString currentToken)
{
    if (currentToken.isEmpty())
    {
        LOG(VB_GENERAL, LOG_ERR, QString("UPnpCDSTV::LoadMetadata: Final "
                                         "token missing from id: %1")
                                        .arg(pRequest->m_sParentId));
        return false;
    }

    // Root or Root + 1
    if (tokens[currentToken].isEmpty())
    {
        CDSObject *container = NULL;

        if (pRequest->m_sObjectId == m_sExtensionId)
            container = GetRoot();
        else
            container = GetRoot()->GetChild(pRequest->m_sObjectId);

        if (container)
        {
            pResults->Add(container);
            pResults->m_nTotalMatches = 1;
            return true;
        }
        else
            LOG(VB_GENERAL, LOG_ERR, QString("UPnpCDSTV::LoadMetadata: Requested "
                                             "object cannot be found: %1")
                                               .arg(pRequest->m_sObjectId));
    }
    else if (currentToken == "series")
    {
         return LoadSeries(pRequest, pResults, tokens);
    }
    else if (currentToken == "season")
    {
         return LoadSeasons(pRequest, pResults, tokens);
    }
    else if (currentToken == "genre")
    {
        return LoadGenres(pRequest, pResults, tokens);
    }
    else if (currentToken == "movie")
    {
        return LoadMovies(pRequest, pResults, tokens);
    }
    else if (currentToken == "video")
    {
        return LoadVideos(pRequest, pResults, tokens);
    }
    else
        LOG(VB_GENERAL, LOG_ERR,
            QString("UPnpCDSVideo::LoadMetadata(): "
                    "Unhandled metadata request for '%1'.").arg(currentToken));

    return false;
}
Ejemplo n.º 2
0
Tags::Tags()
{
   mEditTitle = true;
   mEditTrackNumber = true;

   LoadDefaults();
   LoadGenres();
}
Ejemplo n.º 3
0
bool UPnpCDSVideo::LoadChildren(const UPnpCDSRequest* pRequest,
                                UPnpCDSExtensionResults* pResults,
                                IDTokenMap tokens, QString currentToken)
{
    if (currentToken.isEmpty() || currentToken == m_sExtensionId.toLower())
    {
        // Root
        pResults->Add(GetRoot()->GetChildren());
        pResults->m_nTotalMatches = GetRoot()->GetChildCount();
        return true;
    }
    else if (currentToken == "series")
    {
         if (!tokens["series"].isEmpty())
             return LoadSeasons(pRequest, pResults, tokens);
         else
             return LoadSeries(pRequest, pResults, tokens);
    }
    else if (currentToken == "season")
    {
         if (!tokens["season"].isEmpty() && tokens["season"].toInt() >= 0) // Season 0 is valid
             return LoadVideos(pRequest, pResults, tokens);
         else
             return LoadSeasons(pRequest, pResults, tokens);
    }
    else if (currentToken == "genre")
    {
        if (!tokens["genre"].isEmpty())
            return LoadVideos(pRequest, pResults, tokens);
        else
            return LoadGenres(pRequest, pResults, tokens);
    }
    else if (currentToken == "movie")
    {
         return LoadMovies(pRequest, pResults, tokens);
    }
    else if (currentToken == "video")
    {
        return LoadVideos(pRequest, pResults, tokens);
    }
    else
        LOG(VB_GENERAL, LOG_ERR,
            QString("UPnpCDSVideo::LoadChildren(): "
                    "Unhandled metadata request for '%1'.").arg(currentToken));

    return false;
}
Ejemplo n.º 4
0
static void InitGenres(HWND hwnd)
{
	HWND hgen = GetDlgItem(hwnd, IDC_GENRE);
	char *c;

	/* set text length limit to 64 chars */
	SendMessage(hgen, CB_LIMITTEXT, 64, 0);
	/* try to load genres */
	if (!genres)
		LoadGenres(hgen);
	/* add the to list */
	if (genres)
	{
		SendMessage(hgen, CB_INITSTORAGE, genresCount, genresSize);

		for (c = genres; *c; c += strlen(c)+1)
			SendMessage(hgen, CB_ADDSTRING, 0, (LPARAM)c);
	}
}
Ejemplo n.º 5
0
void UPnpCDSVideo::CreateRoot()
{
    if (m_pRoot)
        return;

    m_pRoot = CDSObject::CreateContainer(m_sExtensionId,
                                         m_sName,
                                         "0");

    CDSObject* pContainer;
    QString containerId = m_sExtensionId + "/%1";

    // HACK: I'm not entirely happy with this solution, but it's at least
    // tidier than passing through half a dozen extra args to Load[Foo]
    // or having yet more methods just to load the counts
    UPnpCDSRequest *pRequest = new UPnpCDSRequest();
    pRequest->m_nRequestedCount = 0; // We don't want to load any results, we just want the TotalCount
    UPnpCDSExtensionResults *pResult = new UPnpCDSExtensionResults();
    IDTokenMap tokens;
    // END HACK

    // -----------------------------------------------------------------------
    // All Videos
    // -----------------------------------------------------------------------
    pContainer = CDSObject::CreateContainer ( containerId.arg("Video"),
                                              QObject::tr("All Videos"),
                                              m_sExtensionId, // Parent Id
                                              NULL );
    // HACK
    LoadVideos(pRequest, pResult, tokens);
    pContainer->SetChildCount(pResult->m_nTotalMatches);
    pContainer->SetChildContainerCount(0);
    // END HACK
    m_pRoot->AddChild(pContainer);

    // -----------------------------------------------------------------------
    // Films
    // -----------------------------------------------------------------------
    pContainer = CDSObject::CreateContainer ( containerId.arg("Movie"),
                                              QObject::tr("Movies"),
                                              m_sExtensionId, // Parent Id
                                              NULL );
    // HACK
    LoadMovies(pRequest, pResult, tokens);
    pContainer->SetChildCount(pResult->m_nTotalMatches);
    pContainer->SetChildContainerCount(0);
    // END HACK
    m_pRoot->AddChild(pContainer);

    // -----------------------------------------------------------------------
    // Series
    // -----------------------------------------------------------------------
    pContainer = CDSObject::CreateContainer ( containerId.arg("Series"),
                                              QObject::tr("Series"),
                                              m_sExtensionId, // Parent Id
                                              NULL );
    // HACK
    LoadSeries(pRequest, pResult, tokens);
    pContainer->SetChildCount(pResult->m_nTotalMatches);
    pContainer->SetChildContainerCount(0);
    // END HACK
    m_pRoot->AddChild(pContainer);

    // -----------------------------------------------------------------------
    // Other (Home videos?)
    // -----------------------------------------------------------------------
//     pContainer = CDSObject::CreateContainer ( containerId.arg("Other"),
//                                               QObject::tr("Other"),
//                                               m_sExtensionId, // Parent Id
//                                               NULL );
//     m_pRoot->AddChild(pContainer);

    // -----------------------------------------------------------------------
    // Genre
    // -----------------------------------------------------------------------
    pContainer = CDSObject::CreateContainer ( containerId.arg("Genre"),
                                              QObject::tr("Genre"),
                                              m_sExtensionId, // Parent Id
                                              NULL );
    // HACK
    LoadGenres(pRequest, pResult, tokens);
    pContainer->SetChildCount(pResult->m_nTotalMatches);
    pContainer->SetChildContainerCount(0);
    // END HACK
    m_pRoot->AddChild(pContainer);

    // -----------------------------------------------------------------------
    // By Directory
    // -----------------------------------------------------------------------
//     pContainer = CDSObject::CreateStorageSystem ( containerId.arg("Directory"),
//                                                   QObject::tr("Directory"),
//                                                   m_sExtensionId, // Parent Id
//                                                   NULL );
//    m_pRoot->AddChild(pContainer);

    // HACK
    delete pRequest;
    delete pResult;
    // END HACK
}