home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
MediaPortal 1 Plugins
Popular Plugins
My TVSeries
Fixing the ordering problem
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="frying_fish" data-source="post: 307586" data-attributes="member: 81857"><p>Hey people, </p><p></p><p></p><p>just wondering if there are any people that have also looked at the code for matching a localepisode to an online episode in Onlineparse.cs. The method is matchOnlineToLocalEpisode (starting around line 1300).</p><p></p><p>I've been looking through this over the last couple of days, and have made a little bit of progress, I have a way that works for DVD ordering, (or on what I've tried so far, I don't know how it will handle double episodes currently). I'm also currently looking at absolute ordering, I can get it to find the correct episode now and fill in the correct information with regards to the file, however in the configuration screen it is still showing them slightly wrong.</p><p></p><p>i.e. with naruto:</p><p></p><p>Naruto</p><p>- Specials</p><p> - 0x2 (corresponds to episode 002 as would expect)</p><p> - 0x56 (corresponds to episode 056)</p><p>- Season 1</p><p> - 1x2 (corresponds to episode 102)</p><p></p><p></p><p>So I'm a little confused, as its not altering the season and episode index that it first obtains, even though I thought I was changing it, I was trying to make them all have season index 1 and the episode index as their absolute number where as in the db it seems to be keeping the listed one (for display) as the ones it first parsed in.</p><p></p><p>the code for absolute is: (and if you know how to solve this issue then please say)</p><p></p><p>[code]</p><p>case "Absolute":</p><p> </p><p> System.Globalization.NumberFormatInfo provided = new System.Globalization.NumberFormatInfo();</p><p> float onlineabs = -1;</p><p> float onlineabsTemp;</p><p> if (float.TryParse(onlineEpisode["absolute_number"], System.Globalization.NumberStyles.AllowDecimalPoint, provided, out onlineabsTemp))</p><p> onlineabs = onlineabsTemp;</p><p> MPTVSeriesLog.Write(string.Format("Absolute number: {0}", onlineabs));</p><p> if(onlineabs !=-1)</p><p> {</p><p> double localabs= -1;</p><p> if ((int)localEpisode[DBEpisode.cSeasonIndex] == 0)</p><p> {</p><p> /*Now we have to figure out whether we are at ep 100 or more*/</p><p> localabs = Convert.ToDouble(localEpisode[DBEpisode.cSeasonIndex].ToString() + localEpisode[DBEpisode.cEpisodeIndex].ToString());</p><p> }</p><p> else if((int)localEpisode[DBEpisode.cSeasonIndex] >=1 && (int)localEpisode[DBEpisode.cEpisodeIndex] < 10 )</p><p> {/* Any episode X0[0-9] should be combined in this manner */</p><p> localabs = Convert.ToDouble(localEpisode[DBEpisode.cSeasonIndex].ToString() + "0" + localEpisode[DBEpisode.cEpisodeIndex].ToString());</p><p> }</p><p> else if ((int)localEpisode[DBEpisode.cSeasonIndex] >= 1 && (int)localEpisode[DBEpisode.cEpisodeIndex] >= 10 )</p><p> {/* All other episodes should fall into this category */</p><p> localabs = Convert.ToDouble(localEpisode[DBEpisode.cSeasonIndex].ToString() + localEpisode[DBEpisode.cEpisodeIndex].ToString());</p><p> }</p><p> </p><p> float.TryParse(onlineEpisode["absolute_number"], System.Globalization.NumberStyles.AllowDecimalPoint, provided, out onlineabs);</p><p> if(localabs == onlineabs)</p><p> {</p><p> onlineEpisode[DBEpisode.cSeasonIndex] = 1;</p><p> onlineEpisode[DBEpisode.cEpisodeIndex] = (int)localabs;</p><p> MPTVSeriesLog.Write(string.Format("Matched Absolute Ep {0} to local ep {1}{2}", onlineabs, series, localEpisode ),</p><p> MPTVSeriesLog.LogLevel.Debug);</p><p> return true;</p><p> }</p><p> else</p><p> {</p><p> MPTVSeriesLog.Write(string.Format("Failed to Match local ep {1}{2} to Absolute ep {0}", onlineabs, series, localEpisode ),</p><p> MPTVSeriesLog.LogLevel.Debug);</p><p> return false;</p><p> }</p><p> } break;</p><p>[/code]</p><p></p><p>This is clearly an early prototype but if anyone can spot any glaring errors then let me know.</p><p></p><p></p><p>also, here is my current state of DVD ordering (again its not pretty or by any means fully correct, but it seems to do the job (lots of testing, i.e. double episodes) [ it does work for firefly and futurama, where firefly - 1x01 - serenity is the name for 1.1 & 1.2]</p><p></p><p>[code]</p><p>case "DVD":</p><p> System.Globalization.NumberFormatInfo provider = new System.Globalization.NumberFormatInfo();</p><p> provider.NumberDecimalSeparator = ".";</p><p> int localSeason = (int)localEpisode[DBEpisode.cSeasonIndex];</p><p> float onlineSeasonTemp;</p><p> int onlineSeason = -1; </p><p> if( float.TryParse(onlineEpisode["DVD_season"], System.Globalization.NumberStyles.AllowDecimalPoint, provider, out onlineSeasonTemp))</p><p> onlineSeason = (int)onlineSeasonTemp;</p><p> </p><p> int localEp = (int)localEpisode[DBEpisode.cEpisodeIndex];</p><p> int localEp2 = (int)localEpisode[DBEpisode.cEpisodeIndex2];</p><p> </p><p> if (Helper.String.IsNullOrEmpty(localEpisode[DBEpisode.cEpisodeIndex2])) localEp2 = 0;</p><p> float onlineEp = -1;</p><p> </p><p> </p><p> if (onlineSeason != -1 && float.TryParse(onlineEpisode["DVD_episodenumber"], System.Globalization.NumberStyles.AllowDecimalPoint,</p><p> provider, out onlineEp))</p><p> {</p><p> //MPTVSeriesLog.Write(string.Format("Series {0} , localEp {1} localEp2 {2} onlineEp {3}", onlineSeason, localEp, localEp2, onlineEp));</p><p> /*if (!Helper.String.IsNullOrEmpty(onlineEpisode["DVD_season"]) && !Helper.String.IsNullOrEmpty(onlineEpisode["DVD_season"]) &&</p><p> (localSeason == onlineSeason && ((int)localEp == (int)onlineEp || (int)localEp2 == -1 ? false : (int)localEp2 == (int)onlineEp)))</p><p> */</p><p> </p><p> //if(localEp == (int)onlineEp)</p><p> string localstring;</p><p> double localcomp;</p><p> localstring = (localEp.ToString() + "." + localEp2.ToString());</p><p> localcomp = Convert.ToDouble(localstring);</p><p> if(!Helper.String.IsNullOrEmpty(onlineEpisode["DVD_season"]) && !Helper.String.IsNullOrEmpty(onlineEpisode["DVD_episodenumber"])</p><p> && (localSeason == onlineSeason && (localcomp == onlineEp || localEp == (int) onlineEp)))</p><p> {</p><p> /*check that the vital parts exist DVD_season and DVD_episodenumber, then check to see if we have a match either for the full</p><p> possible online format of X.Y via the use of localcomp and some string combinations, or through the default style of X.0 </p><p> via integer comparison*/</p><p> // overwrite onlineEps season/ep #</p><p> onlineEpisode[DBOnlineEpisode.cSeasonIndex] = (int)localEpisode[DBEpisode.cSeasonIndex];</p><p> if (localcomp == onlineEp)</p><p> {</p><p> MPTVSeriesLog.Write(string.Format("Episode {0} matched to episode {1}", localEp, onlineEp),</p><p> MPTVSeriesLog.LogLevel.Debug );</p><p> onlineEpisode[DBEpisode.cEpisodeIndex] = localEp;</p><p> }</p><p> else if (localEp == (int)onlineEp)</p><p> {</p><p> onlineEpisode[DBEpisode.cEpisodeIndex] = localEp;</p><p> }</p><p> return true;</p><p> }</p><p> else</p><p> {</p><p> MPTVSeriesLog.Write(string.Format("File does not match current parse Series: {0} Episode: {1} : Online Episode: {2}",</p><p> localSeason, localcomp, onlineEp), MPTVSeriesLog.LogLevel.Debug);</p><p> return false;</p><p> }</p><p> </p><p> } break;</p><p>[/code]</p></blockquote><p></p>
[QUOTE="frying_fish, post: 307586, member: 81857"] Hey people, just wondering if there are any people that have also looked at the code for matching a localepisode to an online episode in Onlineparse.cs. The method is matchOnlineToLocalEpisode (starting around line 1300). I've been looking through this over the last couple of days, and have made a little bit of progress, I have a way that works for DVD ordering, (or on what I've tried so far, I don't know how it will handle double episodes currently). I'm also currently looking at absolute ordering, I can get it to find the correct episode now and fill in the correct information with regards to the file, however in the configuration screen it is still showing them slightly wrong. i.e. with naruto: Naruto - Specials - 0x2 (corresponds to episode 002 as would expect) - 0x56 (corresponds to episode 056) - Season 1 - 1x2 (corresponds to episode 102) So I'm a little confused, as its not altering the season and episode index that it first obtains, even though I thought I was changing it, I was trying to make them all have season index 1 and the episode index as their absolute number where as in the db it seems to be keeping the listed one (for display) as the ones it first parsed in. the code for absolute is: (and if you know how to solve this issue then please say) [code] case "Absolute": System.Globalization.NumberFormatInfo provided = new System.Globalization.NumberFormatInfo(); float onlineabs = -1; float onlineabsTemp; if (float.TryParse(onlineEpisode["absolute_number"], System.Globalization.NumberStyles.AllowDecimalPoint, provided, out onlineabsTemp)) onlineabs = onlineabsTemp; MPTVSeriesLog.Write(string.Format("Absolute number: {0}", onlineabs)); if(onlineabs !=-1) { double localabs= -1; if ((int)localEpisode[DBEpisode.cSeasonIndex] == 0) { /*Now we have to figure out whether we are at ep 100 or more*/ localabs = Convert.ToDouble(localEpisode[DBEpisode.cSeasonIndex].ToString() + localEpisode[DBEpisode.cEpisodeIndex].ToString()); } else if((int)localEpisode[DBEpisode.cSeasonIndex] >=1 && (int)localEpisode[DBEpisode.cEpisodeIndex] < 10 ) {/* Any episode X0[0-9] should be combined in this manner */ localabs = Convert.ToDouble(localEpisode[DBEpisode.cSeasonIndex].ToString() + "0" + localEpisode[DBEpisode.cEpisodeIndex].ToString()); } else if ((int)localEpisode[DBEpisode.cSeasonIndex] >= 1 && (int)localEpisode[DBEpisode.cEpisodeIndex] >= 10 ) {/* All other episodes should fall into this category */ localabs = Convert.ToDouble(localEpisode[DBEpisode.cSeasonIndex].ToString() + localEpisode[DBEpisode.cEpisodeIndex].ToString()); } float.TryParse(onlineEpisode["absolute_number"], System.Globalization.NumberStyles.AllowDecimalPoint, provided, out onlineabs); if(localabs == onlineabs) { onlineEpisode[DBEpisode.cSeasonIndex] = 1; onlineEpisode[DBEpisode.cEpisodeIndex] = (int)localabs; MPTVSeriesLog.Write(string.Format("Matched Absolute Ep {0} to local ep {1}{2}", onlineabs, series, localEpisode ), MPTVSeriesLog.LogLevel.Debug); return true; } else { MPTVSeriesLog.Write(string.Format("Failed to Match local ep {1}{2} to Absolute ep {0}", onlineabs, series, localEpisode ), MPTVSeriesLog.LogLevel.Debug); return false; } } break; [/code] This is clearly an early prototype but if anyone can spot any glaring errors then let me know. also, here is my current state of DVD ordering (again its not pretty or by any means fully correct, but it seems to do the job (lots of testing, i.e. double episodes) [ it does work for firefly and futurama, where firefly - 1x01 - serenity is the name for 1.1 & 1.2] [code] case "DVD": System.Globalization.NumberFormatInfo provider = new System.Globalization.NumberFormatInfo(); provider.NumberDecimalSeparator = "."; int localSeason = (int)localEpisode[DBEpisode.cSeasonIndex]; float onlineSeasonTemp; int onlineSeason = -1; if( float.TryParse(onlineEpisode["DVD_season"], System.Globalization.NumberStyles.AllowDecimalPoint, provider, out onlineSeasonTemp)) onlineSeason = (int)onlineSeasonTemp; int localEp = (int)localEpisode[DBEpisode.cEpisodeIndex]; int localEp2 = (int)localEpisode[DBEpisode.cEpisodeIndex2]; if (Helper.String.IsNullOrEmpty(localEpisode[DBEpisode.cEpisodeIndex2])) localEp2 = 0; float onlineEp = -1; if (onlineSeason != -1 && float.TryParse(onlineEpisode["DVD_episodenumber"], System.Globalization.NumberStyles.AllowDecimalPoint, provider, out onlineEp)) { //MPTVSeriesLog.Write(string.Format("Series {0} , localEp {1} localEp2 {2} onlineEp {3}", onlineSeason, localEp, localEp2, onlineEp)); /*if (!Helper.String.IsNullOrEmpty(onlineEpisode["DVD_season"]) && !Helper.String.IsNullOrEmpty(onlineEpisode["DVD_season"]) && (localSeason == onlineSeason && ((int)localEp == (int)onlineEp || (int)localEp2 == -1 ? false : (int)localEp2 == (int)onlineEp))) */ //if(localEp == (int)onlineEp) string localstring; double localcomp; localstring = (localEp.ToString() + "." + localEp2.ToString()); localcomp = Convert.ToDouble(localstring); if(!Helper.String.IsNullOrEmpty(onlineEpisode["DVD_season"]) && !Helper.String.IsNullOrEmpty(onlineEpisode["DVD_episodenumber"]) && (localSeason == onlineSeason && (localcomp == onlineEp || localEp == (int) onlineEp))) { /*check that the vital parts exist DVD_season and DVD_episodenumber, then check to see if we have a match either for the full possible online format of X.Y via the use of localcomp and some string combinations, or through the default style of X.0 via integer comparison*/ // overwrite onlineEps season/ep # onlineEpisode[DBOnlineEpisode.cSeasonIndex] = (int)localEpisode[DBEpisode.cSeasonIndex]; if (localcomp == onlineEp) { MPTVSeriesLog.Write(string.Format("Episode {0} matched to episode {1}", localEp, onlineEp), MPTVSeriesLog.LogLevel.Debug ); onlineEpisode[DBEpisode.cEpisodeIndex] = localEp; } else if (localEp == (int)onlineEp) { onlineEpisode[DBEpisode.cEpisodeIndex] = localEp; } return true; } else { MPTVSeriesLog.Write(string.Format("File does not match current parse Series: {0} Episode: {1} : Online Episode: {2}", localSeason, localcomp, onlineEp), MPTVSeriesLog.LogLevel.Debug); return false; } } break; [/code] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
MediaPortal 1 Plugins
Popular Plugins
My TVSeries
Fixing the ordering problem
Contact us
RSS
Top
Bottom