Skip to content

Commit

Permalink
changed: added recently added and missing infoLabels to the python xb…
Browse files Browse the repository at this point in the history
…mcmodule
  • Loading branch information
mkortstiege committed Feb 11, 2011
1 parent cd26d4c commit 79bff68
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 26 deletions.
74 changes: 72 additions & 2 deletions xbmc/interfaces/python/xbmcmodule/infotagmusic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,15 @@ namespace PYXBMC
return Py_BuildValue((char*)"s", self->infoTag.GetArtist().c_str());
}

// InfoTagMusic_GetAlbumArtist
PyDoc_STRVAR(getAlbumArtist__doc__,
"getAlbumArtist() -- returns a string.\n");

PyObject* InfoTagMusic_GetAlbumArtist(InfoTagMusic *self, PyObject *args)
{
return Py_BuildValue((char*)"s", self->infoTag.GetAlbumArtist().c_str());
}

// InfoTagMusic_GetAlbum
PyDoc_STRVAR(getAlbum__doc__,
"getAlbum() -- returns a string.\n");
Expand Down Expand Up @@ -117,7 +126,7 @@ namespace PYXBMC

PyObject* InfoTagMusic_GetTrack(InfoTagMusic *self, PyObject *args)
{
return Py_BuildValue((char*)"s", self->infoTag.GetTrackNumber());
return Py_BuildValue((char*)"i", self->infoTag.GetTrackNumber());
}

// InfoTagMusic_GetDisc
Expand All @@ -126,7 +135,16 @@ namespace PYXBMC

PyObject* InfoTagMusic_GetDisc(InfoTagMusic *self, PyObject *args)
{
return Py_BuildValue((char*)"s", self->infoTag.GetDiscNumber());
return Py_BuildValue((char*)"i", self->infoTag.GetDiscNumber());
}

// InfoTagMusic_GetTrackAndDisc
PyDoc_STRVAR(getTrackAndDisc__doc__,
"getTrackAndDisc() -- returns an integer.\n");

PyObject* InfoTagMusic_GetTrackAndDisc(InfoTagMusic *self, PyObject *args)
{
return Py_BuildValue((char*)"i", self->infoTag.GetTrackAndDiskNumber());
}

// InfoTagMusic_ReleaseDate
Expand All @@ -138,16 +156,68 @@ namespace PYXBMC
return Py_BuildValue((char*)"s", self->infoTag.GetYearString().c_str());
}

// InfoTagMusic_GetListeners
PyDoc_STRVAR(getListeners__doc__,
"getListeners() -- returns an integer.\n");

PyObject* InfoTagMusic_GetListeners(InfoTagMusic *self, PyObject *args)
{
return Py_BuildValue((char*)"i", self->infoTag.GetListeners());
}

// InfoTagMusic_GetPlayCount
PyDoc_STRVAR(getPlayCount__doc__,
"getPlayCount() -- returns an integer.\n");

PyObject* InfoTagMusic_GetPlayCount(InfoTagMusic *self, PyObject *args)
{
return Py_BuildValue((char*)"i", self->infoTag.GetPlayCount());
}

// InfoTagMusic_GetLastPlayed
PyDoc_STRVAR(getLastPlayed__doc__,
"getLastPlayed() -- returns a string.\n");

PyObject* InfoTagMusic_GetLastPlayed(InfoTagMusic *self, PyObject *args)
{
return Py_BuildValue((char*)"s", self->infoTag.GetLastPlayed().c_str());
}

// InfoTagMusic_GetComment
PyDoc_STRVAR(getComment__doc__,
"getComment() -- returns a string.\n");

PyObject* InfoTagMusic_GetComment(InfoTagMusic *self, PyObject *args)
{
return Py_BuildValue((char*)"s", self->infoTag.GetComment().c_str());
}

// InfoTagMusic_GetLyrics
PyDoc_STRVAR(getLyrics__doc__,
"getLyrics() -- returns a string.\n");

PyObject* InfoTagMusic_GetLyrics(InfoTagMusic *self, PyObject *args)
{
return Py_BuildValue((char*)"s", self->infoTag.GetLyrics().c_str());
}

PyMethodDef InfoTagMusic_methods[] = {
{(char*)"getURL", (PyCFunction)InfoTagMusic_GetURL, METH_VARARGS, getURL__doc__},
{(char*)"getTitle", (PyCFunction)InfoTagMusic_GetTitle, METH_VARARGS, getTitle__doc__},
{(char*)"getAlbum", (PyCFunction)InfoTagMusic_GetAlbum, METH_VARARGS, getAlbum__doc__},
{(char*)"getArtist", (PyCFunction)InfoTagMusic_GetArtist, METH_VARARGS, getArtist__doc__},
{(char*)"getAlbumArtist", (PyCFunction)InfoTagMusic_GetAlbumArtist, METH_VARARGS, getAlbumArtist__doc__},
{(char*)"getGenre", (PyCFunction)InfoTagMusic_GetGenre, METH_VARARGS, getGenre__doc__},
{(char*)"getDuration", (PyCFunction)InfoTagMusic_GetDuration, METH_VARARGS, getDuration__doc__},
{(char*)"getTrack", (PyCFunction)InfoTagMusic_GetTrack, METH_VARARGS, getTrack__doc__},
{(char*)"getDisc", (PyCFunction)InfoTagMusic_GetDisc, METH_VARARGS, getDisc__doc__},
{(char*)"getTrackAndDisc", (PyCFunction)InfoTagMusic_GetTrackAndDisc, METH_VARARGS, getTrackAndDisc__doc__},
{(char*)"getReleaseDate", (PyCFunction)InfoTagMusic_GetReleaseDate, METH_VARARGS, getReleaseDate__doc__},
{(char*)"getListeners", (PyCFunction)InfoTagMusic_GetListeners, METH_VARARGS, getListeners__doc__},
{(char*)"getPlayCount", (PyCFunction)InfoTagMusic_GetPlayCount, METH_VARARGS, getPlayCount__doc__},
{(char*)"getLastPlayed", (PyCFunction)InfoTagMusic_GetLastPlayed, METH_VARARGS, getLastPlayed__doc__},
{(char*)"getComment", (PyCFunction)InfoTagMusic_GetComment, METH_VARARGS, getComment__doc__},
{(char*)"getLyrics", (PyCFunction)InfoTagMusic_GetLyrics, METH_VARARGS, getLyrics__doc__},
{NULL, NULL, 0, NULL}
};

Expand Down
44 changes: 23 additions & 21 deletions xbmc/interfaces/python/xbmcmodule/infotagvideo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,7 @@ namespace PYXBMC

PyObject* InfoTagVideo_GetCast(InfoTagVideo *self, PyObject *args)
{
CStdString cast = self->infoTag.GetCast(true);
/*for (CVideoInfoTag::iCast it = self->infoTag.m_cast.begin(); it != self->infoTag.m_cast.end(); ++it)
{
CStdString character;
character.Format("%s %s %s\n", it->first.c_str(), g_localizeStrings.Get(20347).c_str(), it->second.c_str());
cast += character;
}*/
return Py_BuildValue((char*)"s", cast.c_str());
return Py_BuildValue((char*)"s", self->infoTag.GetCast(true).c_str());
}

// InfoTagVideo_GetFile
Expand All @@ -170,16 +163,6 @@ namespace PYXBMC
return Py_BuildValue((char*)"s", self->infoTag.m_strPath.c_str());
}

/*// InfoTagVideo_GetDVDLabel
PyDoc_STRVAR(getDVDLabel__doc__,
"getDVDLabel() -- returns a string.\n");
PyObject* InfoTagVideo_GetDVDLabel(InfoTagVideo *self, PyObject *args)
{
return Py_BuildValue((char*)"s", self->infoTag.m_strDVDLabel.c_str());
}
*/

// InfoTagVideo_GetIMDBNumber
PyDoc_STRVAR(getIMDBNumber__doc__,
"getIMDBNumber() -- returns a string.\n");
Expand All @@ -189,7 +172,7 @@ namespace PYXBMC
return Py_BuildValue((char*)"s", self->infoTag.m_strIMDBNumber.c_str());
}

// InfoTagVideo_GetIMDBNumber
// InfoTagVideo_GetYear
PyDoc_STRVAR(getYear__doc__,
"getYear() -- returns a integer.\n");

Expand All @@ -198,7 +181,7 @@ namespace PYXBMC
return Py_BuildValue((char*)"i", self->infoTag.m_iYear);
}

// InfoTagVideo_GetIMDBNumber
// InfoTagVideo_GetRating
PyDoc_STRVAR(getRating__doc__,
"getRating() -- returns a float.\n");

Expand All @@ -207,6 +190,24 @@ namespace PYXBMC
return Py_BuildValue((char*)"f", self->infoTag.m_fRating);
}

// InfoTagVideo_GetPlayCount
PyDoc_STRVAR(getPlayCount__doc__,
"getPlayCount() -- returns a integer.\n");

PyObject* InfoTagVideo_GetPlayCount(InfoTagVideo *self, PyObject *args)
{
return Py_BuildValue((char*)"i", self->infoTag.m_playCount);
}

// InfoTagVideo_GetLastPlayed
PyDoc_STRVAR(getLastPlayed__doc__,
"getLastPlayed() -- returns a string.\n");

PyObject* InfoTagVideo_GetLastPlayed(InfoTagVideo *self, PyObject *args)
{
return Py_BuildValue((char*)"s", self->infoTag.m_lastPlayed.c_str());
}

PyMethodDef InfoTagVideo_methods[] = {
{(char*)"getDirector", (PyCFunction)InfoTagVideo_GetDirector, METH_VARARGS, getDirector__doc__},
{(char*)"getWritingCredits", (PyCFunction)InfoTagVideo_GetWritingCredits, METH_VARARGS, getWritingCredits__doc__},
Expand All @@ -220,10 +221,11 @@ namespace PYXBMC
{(char*)"getCast", (PyCFunction)InfoTagVideo_GetCast, METH_VARARGS, getCast__doc__},
{(char*)"getFile", (PyCFunction)InfoTagVideo_GetFile, METH_VARARGS, getFile__doc__},
{(char*)"getPath", (PyCFunction)InfoTagVideo_GetPath, METH_VARARGS, getPath__doc__},
//{"(char*)getDVDLabel", (PyCFunction)InfoTagVideo_GetDVDLabel, METH_VARARGS, getDVDLabel__doc__},
{(char*)"getIMDBNumber", (PyCFunction)InfoTagVideo_GetIMDBNumber, METH_VARARGS, getIMDBNumber__doc__},
{(char*)"getYear", (PyCFunction)InfoTagVideo_GetYear, METH_VARARGS, getYear__doc__},
{(char*)"getRating", (PyCFunction)InfoTagVideo_GetRating, METH_VARARGS, getRating__doc__},
{(char*)"getPlayCount", (PyCFunction)InfoTagVideo_GetPlayCount, METH_VARARGS, getPlayCount__doc__},
{(char*)"getLastPlayed", (PyCFunction)InfoTagVideo_GetLastPlayed, METH_VARARGS, getLastPlayed__doc__},
{NULL, NULL, 0, NULL}
};

Expand Down
23 changes: 20 additions & 3 deletions xbmc/interfaces/python/xbmcmodule/listitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,8 @@ namespace PYXBMC
" title : string (American Pie)\n"
" rating : string (3) - single character between 0 and 5\n"
" lyrics : string (On a dark desert highway...)\n"
" playcount : integer (2) - number of times this item has been played\n"
" lastplayed : string (%Y-%m-%d %h:%m:%s = 2009-04-05 23:16:04)\n"
"\n"
"Picture Values:\n"
" title : string (In the last summer-1)\n"
Expand Down Expand Up @@ -539,7 +541,6 @@ namespace PYXBMC
}
else if (strcmpi(cType, "music") == 0)
{
// TODO: add the rest of the infolabels
if (strcmpi(PyString_AsString(key), "tracknumber") == 0)
self->item->GetMusicInfoTag()->SetTrackNumber(PyInt_AsLong(value));
else if (strcmpi(PyString_AsString(key), "count") == 0)
Expand All @@ -551,7 +552,9 @@ namespace PYXBMC
else if (strcmpi(PyString_AsString(key), "year") == 0)
self->item->GetMusicInfoTag()->SetYear(PyInt_AsLong(value));
else if (strcmpi(PyString_AsString(key), "listeners") == 0)
self->item->GetMusicInfoTag()->SetListeners(PyInt_AsLong(value));
self->item->GetMusicInfoTag()->SetListeners(PyInt_AsLong(value));
else if (strcmpi(PyString_AsString(key), "playcount") == 0)
self->item->GetMusicInfoTag()->SetPlayCount(PyInt_AsLong(value));
else
{
if (!PyXBMCGetUnicodeString(tmp, value, 1)) continue;
Expand All @@ -566,7 +569,21 @@ namespace PYXBMC
else if (strcmpi(PyString_AsString(key), "rating") == 0)
self->item->GetMusicInfoTag()->SetRating(*tmp);
else if (strcmpi(PyString_AsString(key), "lyrics") == 0)
self->item->SetProperty("lyrics", tmp);
self->item->GetMusicInfoTag()->SetLyrics(tmp);
else if (strcmpi(PyString_AsString(key), "lastplayed") == 0)
self->item->GetMusicInfoTag()->SetLastPlayed(tmp);
else if (strcmpi(PyString_AsString(key), "musicbrainztrackid") == 0)
self->item->GetMusicInfoTag()->SetMusicBrainzTrackID(tmp);
else if (strcmpi(PyString_AsString(key), "musicbrainzartistid") == 0)
self->item->GetMusicInfoTag()->SetMusicBrainzArtistID(tmp);
else if (strcmpi(PyString_AsString(key), "musicbrainzalbumid") == 0)
self->item->GetMusicInfoTag()->SetMusicBrainzAlbumID(tmp);
else if (strcmpi(PyString_AsString(key), "musicbrainzalbumartistid") == 0)
self->item->GetMusicInfoTag()->SetMusicBrainzAlbumArtistID(tmp);
else if (strcmpi(PyString_AsString(key), "musicbrainztrmid") == 0)
self->item->GetMusicInfoTag()->SetMusicBrainzTRMID(tmp);
else if (strcmpi(PyString_AsString(key), "comment") == 0)
self->item->GetMusicInfoTag()->SetComment(tmp);
else if (strcmpi(PyString_AsString(key), "date") == 0)
{
if (strlen(tmp) == 10)
Expand Down

0 comments on commit 79bff68

Please sign in to comment.