Skip to content
This repository
Browse code

Merge pull request #1549 from mizaki/epID

videodb: storing of unique IDs from scrapers to help identifying media
  • Loading branch information...
commit 8756dfbc0a8e511214bd4f42328954a55355562d 2 parents c6c965b + 502a94d
Sascha Montellese authored October 10, 2012
3  xbmc/interfaces/json-rpc/ServiceDescription.h
@@ -480,7 +480,7 @@ namespace JSONRPC
480 480
                   "\"firstaired\", \"playcount\", \"runtime\", \"director\","
481 481
                   "\"productioncode\", \"season\", \"episode\", \"originaltitle\","
482 482
                   "\"showtitle\", \"cast\", \"streamdetails\", \"lastplayed\", \"fanart\","
483  
-                  "\"thumbnail\", \"file\", \"resume\", \"tvshowid\", \"dateadded\" ]"
  483
+                  "\"thumbnail\", \"file\", \"resume\", \"tvshowid\", \"dateadded\", \"uniqueid\" ]"
484 484
       "}"
485 485
     "}",
486 486
     "\"Video.Fields.MusicVideo\": {"
@@ -661,6 +661,7 @@ namespace JSONRPC
661 661
         "\"productioncode\": { \"type\": \"string\" },"
662 662
         "\"season\": { \"type\": \"integer\" },"
663 663
         "\"episode\": { \"type\": \"integer\" },"
  664
+        "\"uniqueid\": { \"type\": \"object\", \"additionalProperties\": { \"type\": \"string\", \"minLength\": 1 } },"
664 665
         "\"originaltitle\": { \"type\": \"string\" },"
665 666
         "\"showtitle\": { \"type\": \"string\" },"
666 667
         "\"cast\": { \"$ref\": \"Video.Cast\" },"
3  xbmc/interfaces/json-rpc/types.json
@@ -453,7 +453,7 @@
453 453
                 "firstaired", "playcount", "runtime", "director",
454 454
                 "productioncode", "season", "episode", "originaltitle",
455 455
                 "showtitle", "cast", "streamdetails", "lastplayed", "fanart",
456  
-                "thumbnail", "file", "resume", "tvshowid", "dateadded" ]
  456
+                "thumbnail", "file", "resume", "tvshowid", "dateadded", "uniqueid" ]
457 457
     }
458 458
   },
459 459
   "Video.Fields.MusicVideo": {
@@ -634,6 +634,7 @@
634 634
       "productioncode": { "type": "string" },
635 635
       "season": { "type": "integer" },
636 636
       "episode": { "type": "integer" },
  637
+      "uniqueid": { "type": "object", "additionalProperties": { "type": "string", "minLength": 1 } },
637 638
       "originaltitle": { "type": "string" },
638 639
       "showtitle": { "type": "string" },
639 640
       "cast": { "$ref": "Video.Cast" },
2  xbmc/utils/DatabaseUtils.cpp
@@ -252,6 +252,7 @@ std::string DatabaseUtils::GetField(Field field, MediaType mediaType, DatabaseQu
252 252
     else if (field == FieldDirector) result.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_DIRECTOR);
253 253
     else if (field == FieldSeason) result.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_SEASON);
254 254
     else if (field == FieldEpisodeNumber) result.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_EPISODE);
  255
+    else if (field == FieldUniqueId) result.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_UNIQUEID);
255 256
     else if (field == FieldEpisodeNumberSpecialSort) result.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_SORTEPISODE);
256 257
     else if (field == FieldSeasonSpecialSort) result.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_SORTSEASON);
257 258
     else if (field == FieldFilename) return "episodeview.strFilename";
@@ -430,6 +431,7 @@ int DatabaseUtils::GetFieldIndex(Field field, MediaType mediaType)
430 431
     else if (field == FieldDirector) index = VIDEODB_ID_EPISODE_DIRECTOR;
431 432
     else if (field == FieldSeason) index = VIDEODB_ID_EPISODE_SEASON;
432 433
     else if (field == FieldEpisodeNumber) index = VIDEODB_ID_EPISODE_EPISODE;
  434
+    else if (field == FieldUniqueId) index = VIDEODB_ID_EPISODE_UNIQUEID;
433 435
     else if (field == FieldEpisodeNumberSpecialSort) index = VIDEODB_ID_EPISODE_SORTEPISODE;
434 436
     else if (field == FieldSeasonSpecialSort) index = VIDEODB_ID_EPISODE_SORTSEASON;
435 437
     else if (field == FieldFilename) return VIDEODB_DETAILS_EPISODE_FILE;
1  xbmc/utils/DatabaseUtils.h
@@ -92,6 +92,7 @@ typedef enum {
92 92
   FieldWriter,
93 93
   FieldAirDate,
94 94
   FieldEpisodeNumber,
  95
+  FieldUniqueId,
95 96
   FieldSeason,
96 97
   FieldEpisodeNumberSpecialSort,
97 98
   FieldSeasonSpecialSort,
4  xbmc/video/VideoDatabase.h
@@ -259,6 +259,7 @@ typedef enum // this enum MUST match the offset struct further down!! and make s
259 259
   VIDEODB_ID_EPISODE_BOOKMARK = 17,
260 260
   VIDEODB_ID_EPISODE_BASEPATH = 18,
261 261
   VIDEODB_ID_EPISODE_PARENTPATHID = 19,
  262
+  VIDEODB_ID_EPISODE_UNIQUEID = 20,
262 263
   VIDEODB_ID_EPISODE_MAX
263 264
 } VIDEODB_EPISODE_IDS;
264 265
 
@@ -283,7 +284,8 @@ const struct SDbTableOffsets DbEpisodeOffsets[] =
283 284
   { VIDEODB_TYPE_INT, my_offsetof(CVideoInfoTag,m_iSpecialSortEpisode) },
284 285
   { VIDEODB_TYPE_INT, my_offsetof(CVideoInfoTag,m_iBookmarkId) },
285 286
   { VIDEODB_TYPE_STRING, my_offsetof(CVideoInfoTag,m_basePath) },
286  
-  { VIDEODB_TYPE_INT, my_offsetof(CVideoInfoTag,m_parentPathID) }
  287
+  { VIDEODB_TYPE_INT, my_offsetof(CVideoInfoTag,m_parentPathID) },
  288
+  { VIDEODB_TYPE_STRING, my_offsetof(CVideoInfoTag,m_strUniqueId) }
287 289
 };
288 290
 
289 291
 typedef enum // this enum MUST match the offset struct further down!! and make sure to keep min and max at -1 and sizeof(offsets)
6  xbmc/video/VideoInfoTag.cpp
@@ -70,6 +70,7 @@ void CVideoInfoTag::Reset()
70 70
   m_iYear = 0;
71 71
   m_iSeason = -1;
72 72
   m_iEpisode = -1;
  73
+  m_strUniqueId.clear();
73 74
   m_iSpecialSortSeason = -1;
74 75
   m_iSpecialSortEpisode = -1;
75 76
   m_fRating = 0.0f;
@@ -120,6 +121,7 @@ bool CVideoInfoTag::Save(TiXmlNode *node, const CStdString &tag, bool savePathIn
120 121
   {
121 122
     XMLUtils::SetInt(movie, "season", m_iSeason);
122 123
     XMLUtils::SetInt(movie, "episode", m_iEpisode);
  124
+    XMLUtils::SetString(movie, "uniqueid", m_strUniqueId);
123 125
     XMLUtils::SetInt(movie, "displayseason",m_iSpecialSortSeason);
124 126
     XMLUtils::SetInt(movie, "displayepisode",m_iSpecialSortEpisode);
125 127
   }
@@ -314,6 +316,7 @@ void CVideoInfoTag::Archive(CArchive& ar)
314 316
     ar << m_iYear;
315 317
     ar << m_iSeason;
316 318
     ar << m_iEpisode;
  319
+    ar << m_strUniqueId;
317 320
     ar << m_fRating;
318 321
     ar << m_iDbId;
319 322
     ar << m_iFileId;
@@ -391,6 +394,7 @@ void CVideoInfoTag::Archive(CArchive& ar)
391 394
     ar >> m_iYear;
392 395
     ar >> m_iSeason;
393 396
     ar >> m_iEpisode;
  397
+    ar >> m_strUniqueId;
394 398
     ar >> m_fRating;
395 399
     ar >> m_iDbId;
396 400
     ar >> m_iFileId;
@@ -464,6 +468,7 @@ void CVideoInfoTag::Serialize(CVariant& value) const
464 468
   value["year"] = m_iYear;
465 469
   value["season"] = m_iSeason;
466 470
   value["episode"] = m_iEpisode;
  471
+  value["uniqueid"]["unknown"] = m_strUniqueId;
467 472
   value["rating"] = m_fRating;
468 473
   value["dbid"] = m_iDbId;
469 474
   value["fileid"] = m_iFileId;
@@ -570,6 +575,7 @@ void CVideoInfoTag::ParseNative(const TiXmlElement* movie, bool prioritise)
570 575
   XMLUtils::GetInt(movie, "season", m_iSeason);
571 576
   XMLUtils::GetInt(movie, "episode", m_iEpisode);
572 577
   XMLUtils::GetInt(movie, "track", m_iTrack);
  578
+  XMLUtils::GetString(movie, "uniqueid", m_strUniqueId);
573 579
   XMLUtils::GetInt(movie, "displayseason", m_iSpecialSortSeason);
574 580
   XMLUtils::GetInt(movie, "displayepisode", m_iSpecialSortEpisode);
575 581
   int after=0;
1  xbmc/video/VideoInfoTag.h
@@ -120,6 +120,7 @@ class CVideoInfoTag : public IArchivable, public ISerializable, public ISortable
120 120
   int m_iYear;
121 121
   int m_iSeason;
122 122
   int m_iEpisode;
  123
+  CStdString m_strUniqueId;
123 124
   int m_iDbId;
124 125
   int m_iFileId;
125 126
   int m_iSpecialSortSeason;

0 notes on commit 8756dfb

Please sign in to comment.
Something went wrong with that request. Please try again.