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
Moving Pictures
Help with samples filter RegEx
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="ajs" data-source="post: 1164938" data-attributes="member: 68833"><p>[USER=76888]@kiwijunglist[/USER]</p><p>Try set "<strong>Max Filesize (MB)</strong> - If the filesize of the potential sample file is below this value it will be skipped." to large value, like 500 or bigger ... but:</p><p>[CODE=C#]long sampleMaxSize = MovingPicturesCore.Settings.MaxSampleFilesize * 1024 * 1024;</p><p>bool match = (file.Length < sampleMaxSize);</p><p>if(match){...[/CODE]</p><p>IMHO wrong logic <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite3" alt=":(" title="Frown :(" loading="lazy" data-shortname=":(" /> I would have done so:</p><p>[CODE=C#]public static bool isSampleFile(FileInfo file) {</p><p> try {</p><p> // Create the sample filter regular expression</p><p> Regex expr = new Regex(MovingPicturesCore.Settings.SampleRegExFilter, RegexOptions.IgnoreCase);</p><p> // Set sample max size in bytes and check the file size</p><p> long sampleMaxSize = MovingPicturesCore.Settings.MaxSampleFilesize * 1024 * 1024;</p><p> bool match = (file.Length < sampleMaxSize);</p><p> if (!match) {</p><p> // check the filename</p><p> match = expr.Match(file.Name).Success;</p><p> if (!match && MovingPicturesCore.Settings.SampleIncludeFolderName) {</p><p> // check the folder name if specified</p><p> match = expr.Match(file.DirectoryName).Success;</p><p> }</p><p> }</p><p> // Return result of given conditions </p><p> return match;</p><p> }</p><p> catch (Exception e) {</p><p> if (e is ThreadAbortException)</p><p> throw e;</p><p> logger.Warn("Sample file check failed: {0}", e.Message);</p><p> return false;</p><p> }</p><p> }[/CODE]</p></blockquote><p></p>
[QUOTE="ajs, post: 1164938, member: 68833"] [USER=76888]@kiwijunglist[/USER] Try set "[B]Max Filesize (MB)[/B] - If the filesize of the potential sample file is below this value it will be skipped." to large value, like 500 or bigger ... but: [CODE=C#]long sampleMaxSize = MovingPicturesCore.Settings.MaxSampleFilesize * 1024 * 1024; bool match = (file.Length < sampleMaxSize); if(match){...[/CODE] IMHO wrong logic :( I would have done so: [CODE=C#]public static bool isSampleFile(FileInfo file) { try { // Create the sample filter regular expression Regex expr = new Regex(MovingPicturesCore.Settings.SampleRegExFilter, RegexOptions.IgnoreCase); // Set sample max size in bytes and check the file size long sampleMaxSize = MovingPicturesCore.Settings.MaxSampleFilesize * 1024 * 1024; bool match = (file.Length < sampleMaxSize); if (!match) { // check the filename match = expr.Match(file.Name).Success; if (!match && MovingPicturesCore.Settings.SampleIncludeFolderName) { // check the folder name if specified match = expr.Match(file.DirectoryName).Success; } } // Return result of given conditions return match; } catch (Exception e) { if (e is ThreadAbortException) throw e; logger.Warn("Sample file check failed: {0}", e.Message); return false; } }[/CODE] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
MediaPortal 1 Plugins
Popular Plugins
Moving Pictures
Help with samples filter RegEx
Contact us
RSS
Top
Bottom