summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-08-10 19:58:20 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-08-10 19:58:20 -0400
commit28f07ad61e6af39a71853088ca88322f1775eb47 (patch)
tree0c67024fd908772c89c173cd891a03603e6db63b
parent3b3e5932e75b2656299946c23fa444bc26f79356 (diff)
parent32e49e63d8503cc2f06582da115ad9fece4db328 (diff)
Merge branch 'master' of ssh://git-annex.branchable.com
-rw-r--r--doc/tips/dumb_metadata_extraction_from_xbmc.mdwn14
-rw-r--r--doc/tips/dumb_metadata_extraction_from_xbmc/git-annex-xbmc-playcount.pl4
2 files changed, 18 insertions, 0 deletions
diff --git a/doc/tips/dumb_metadata_extraction_from_xbmc.mdwn b/doc/tips/dumb_metadata_extraction_from_xbmc.mdwn
index a96fe273f..652c37e5b 100644
--- a/doc/tips/dumb_metadata_extraction_from_xbmc.mdwn
+++ b/doc/tips/dumb_metadata_extraction_from_xbmc.mdwn
@@ -12,4 +12,18 @@ Also notice how I remove the absolute prefix for the annex so that i can refer t
So this quick and dirty hack could have been used to mark files as "new". Unfortunately, this won't unmark them when the playcount increases. So instead I think this should be a field, and we need to extract the playcount. Play around with shell scripting enough to get sick, get back into bad perl habits and you'll end up with this nasty script: [[git-annex-xbmc-playcount.pl]].
+After the script is ran, you can sort the files by play count with:
+
+ git annex view "playCount=*"
+
+Or just show the files that haven't been played yet:
+
+ git annex view playCount=0
+
+Use `git checkout master` to reset the view. Note that the above will flatten the tree hierarchy, which you may not way. Try this in that case:
+
+ git annex view playCount=0 films/=*
+
+For more information, see [[tips/metadata_driven_views/]].
+
-- [[anarcat]]
diff --git a/doc/tips/dumb_metadata_extraction_from_xbmc/git-annex-xbmc-playcount.pl b/doc/tips/dumb_metadata_extraction_from_xbmc/git-annex-xbmc-playcount.pl
index 1fa7f0baa..76ad33649 100644
--- a/doc/tips/dumb_metadata_extraction_from_xbmc/git-annex-xbmc-playcount.pl
+++ b/doc/tips/dumb_metadata_extraction_from_xbmc/git-annex-xbmc-playcount.pl
@@ -7,6 +7,10 @@ my @lines = `echo 'SELECT playCount, path.strPath, files.strFileName FROM movie
for (@lines) {
my ($count, $dir, $file) = split /\|/;
chomp $file;
+ # empty or non-numeric count is zero
+ if ($count !~ /[0-9]/) {
+ $count = 0;
+ }
$dir =~ s/$prefix//;
if ($file =~ s#stack://##) {
for (split /,/, $file) {