* include omdb dump in movie index

* allow foreach for AssociativeScriptObjects
* added sysenv script used for printing out system properties and environment variables
This commit is contained in:
Reinhard Pointner 2012-12-05 09:36:30 +00:00
parent 5f9dd965de
commit ee6330a10c
5 changed files with 38 additions and 12 deletions

View File

@ -71,15 +71,22 @@ imdb_ids = new HashSet(imdb.collect{ it[0] })
// BUILD movies.txt.gz
def osdb_tsv = new URL("http://www.opensubtitles.org/addons/export_movie.php")
def osdb = []
def osdb = new TreeSet({ a, b -> a[0].compareTo(b[0]) } as Comparator)
osdb_tsv.getText('UTF-8').eachLine{
def line = it.split(/\t/)*.replaceAll(/\s+/, ' ')*.trim()
if (line.size() == 4 && line[0] =~ /\d+/) {
osdb << [line[1].toInteger(), line[2], line[3].toInteger()]
}
}
osdb = osdb.findAll{ it[0] <= 9999999 && it[2] >= 1930 && it[1] =~ /^[A-Z0-9]/ && it[1] =~ /[\p{Alpha}]{3}/ }.collect{ [it[0].pad(7), it[1], it[2]] }
new File('omdb.txt').eachLine{
def line = it.split(/\t/)
if (line.length > 11 && line[5] =~ /h/ && line[3].toInteger() >= 1970 && (tryQuietly{ line[11].toFloat() } ?: 0) > 1 && (tryQuietly{ line[12].toInteger() } ?: 0) >= 10) {
line = line*.replaceAll(/\s+/, ' ')*.trim()
osdb << [line[0].toInteger(), line[2], line[3].toInteger()]
}
}
osdb = osdb.findAll{ it[0] <= 9999999 && it[2] >= 1930 && it[1] =~ /^[A-Z0-9]/ && it[1] =~ /[\p{Alpha}]{3}/ }.collect{ [it[0].pad(7), it[1], it[2]] }
parallel(osdb.collect{ row ->
return {

View File

@ -9,13 +9,14 @@ import java.util.AbstractSet;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeSet;
public class AssociativeScriptObject extends GroovyObjectSupport {
public class AssociativeScriptObject extends GroovyObjectSupport implements Iterable<Entry<Object, Object>> {
private final Map<?, ?> properties;
private final Map<Object, Object> properties;
public AssociativeScriptObject(Map<?, ?> properties) {
@ -26,8 +27,10 @@ public class AssociativeScriptObject extends GroovyObjectSupport {
/**
* Get the property with the given name.
*
* @param name the property name
* @param start the object where the lookup began
* @param name
* the property name
* @param start
* the object where the lookup began
*/
@Override
public Object getProperty(String name) {
@ -41,6 +44,12 @@ public class AssociativeScriptObject extends GroovyObjectSupport {
}
@Override
public Iterator<Entry<Object, Object>> iterator() {
return properties.entrySet().iterator();
}
@Override
public String toString() {
// all the properties in alphabetic order
@ -92,7 +101,6 @@ public class AssociativeScriptObject extends GroovyObjectSupport {
public Set<Entry<Object, Object>> entrySet() {
return new AbstractSet<Entry<Object, Object>>() {
@SuppressWarnings("unchecked")
@Override
public Iterator<Entry<Object, Object>> iterator() {
return (Iterator) lookup.values().iterator();

View File

@ -114,21 +114,21 @@
<div class="header">
<a href="http://filebot.sourceforge.net"><img class="logo" alt="logo" src="images/icon.png" width="48" height="48" /></a>
<h1>
Episode Format Expressions
<span class="description">User defined episode naming scheme</span>
Format Expressions
<span class="description">User defined episode / movie naming scheme</span>
</h1>
</div>
<div class="content">
<div class="screenshot">
<a href="gallery.html#screenshots/original/dialog.format.png" title="Episode Format Dialog" target="_blank">
<a href="gallery.html#screenshots/original/dialog.format.png" title="Format Dialog" target="_blank">
<img alt="screenshot" src="screenshots/medium/dialog.format.png" />
</a>
</div>
<div class="section about">
<h2>About</h2>
<p>
You can easily define your own episode naming scheme. It uses <a href="http://groovy.codehaus.org">Groovy</a> expressions,
You can easily define your own episode and movie naming schemes. It uses <a href="http://groovy.codehaus.org">Groovy</a> expressions,
which means that you can do pretty much anything, especially if you know a little bit about programming.
You even get media info bindings. You can find <a href="http://filebot.sourceforge.net/forums/viewtopic.php?f=5&amp;t=2#p51">predefined format expressions</a> for all kinds of scenarios in the forums. Ready for you to just copy &amp; paste.
</p>

View File

@ -0,0 +1,11 @@
// filebot -script fn:sysenv
println '# Java System Properties #'
_system.each{
println "$it.key: $it.value"
}
println '# Environment Variables #'
_environment.each{
println "$it.key: $it.value"
}

View File

@ -1,4 +1,4 @@
// filebot -script "fn:sysinfo"
// filebot -script fn:sysinfo
// FileBot 2.62 (r993)
println net.sourceforge.filebot.Settings.applicationIdentifier