Skip to content
This repository

added: $LOCALIZE[id] in scrapers #906

Merged
1 commit merged into from almost 2 years ago

1 participant

jmarshallnz
Deleted user
ghost commented April 30, 2012

The content you are editing has changed. Reload the page and try again.

this allows the use of localized strings inside the scrapers

also bumps xbmc.metadata to 2.1

Sending Request…

Attach images by dragging & dropping or selecting them. Octocat-spinner-32 Uploading your images… Unfortunately, we don't support that file type. Try again with a PNG, GIF, or JPG. Yowza, that's a big file. Try again with an image file smaller than 10MB. This browser doesn't support image attachments. We recommend updating to the latest Internet Explorer, Google Chrome, or Firefox. Something went really wrong, and we can't process that image. Try again.

jmarshallnz
Owner

Hmm, is this data going to end up in the database? I guess scraped data is normally localised anyway, so I guess there's no real issue.

Deleted user
ghost commented April 30, 2012

The content you are editing has changed. Reload the page and try again.

i don't know what olympia has planned (did it on his request), but i can envision shit like prefix'd search results etc e.g. [Album] Bar

Sending Request…

Attach images by dragging & dropping or selecting them. Octocat-spinner-32 Uploading your images… Unfortunately, we don't support that file type. Try again with a PNG, GIF, or JPG. Yowza, that's a big file. Try again with an image file smaller than 10MB. This browser doesn't support image attachments. We recommend updating to the latest Internet Explorer, Google Chrome, or Firefox. Something went really wrong, and we can't process that image. Try again.

jmarshallnz
Owner

Ok - it'd be fine in that case.

Deleted user ghost merged commit a310b4a into from May 04, 2012
Deleted user ghost closed this May 04, 2012
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Apr 30, 2012
added: $LOCALIZE[id] in scrapers 5c5bd1d
This page is out of date. Refresh to see the latest.
2  addons/xbmc.metadata/addon.xml
... ...
@@ -1,5 +1,5 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2  
-<addon id="xbmc.metadata" version="2.0" provider-name="Team XBMC">
  2
+<addon id="xbmc.metadata" version="2.1" provider-name="Team XBMC">
3 3
   <backwards-compatibility abi="1.0"/>
4 4
   <requires>
5 5
     <import addon="xbmc.core" version="0.1"/>
12  xbmc/utils/ScraperParser.cpp
@@ -164,6 +164,18 @@ void CScraperParser::ReplaceBuffers(CStdString& strDest)
164 164
     strDest.replace(strDest.begin()+iIndex,strDest.begin()+iEnd+1,strReplace);
165 165
     iIndex += strReplace.length();
166 166
   }
  167
+  // insert localize strings
  168
+  iIndex = 0;
  169
+  while ((size_t)(iIndex = strDest.find("$LOCALIZE[",iIndex)) != CStdString::npos)
  170
+  {
  171
+    int iEnd = strDest.Find("]",iIndex);
  172
+    CStdString strInfo = strDest.Mid(iIndex+10,iEnd-iIndex-10);
  173
+    CStdString strReplace;
  174
+    if (m_scraper)
  175
+      strReplace = m_scraper->GetString(strtol(strInfo.c_str(),NULL,10));
  176
+    strDest.replace(strDest.begin()+iIndex,strDest.begin()+iEnd+1,strReplace);
  177
+    iIndex += strReplace.length();
  178
+  }
167 179
   iIndex = 0;
168 180
   while ((size_t)(iIndex = strDest.find("\\n",iIndex)) != CStdString::npos)
169 181
     strDest.replace(strDest.begin()+iIndex,strDest.begin()+iIndex+2,"\n");
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.