Browse Source

added new vdrnfofs - uploaded2-2.3-vdr-stable-PPA

master
mango 3 years ago
parent
commit
41dd913c5f
67 changed files with 1418 additions and 0 deletions
  1. +1
    -0
      v-2.5/vdrnfofs-0.8/.pc/.quilt_patches
  2. +1
    -0
      v-2.5/vdrnfofs-0.8/.pc/.quilt_series
  3. +1
    -0
      v-2.5/vdrnfofs-0.8/.pc/.version
  4. +1
    -0
      v-2.5/vdrnfofs-0.8/.pc/applied-patches
  5. +0
    -0
      v-2.5/vdrnfofs-0.8/.pc/debian-changes-0.7-1yavdr1~natty/vdrnfofs.egg-info/PKG-INFO
  6. +0
    -0
      v-2.5/vdrnfofs-0.8/.pc/debian-changes-0.7-1yavdr1~natty/vdrnfofs.egg-info/SOURCES.txt
  7. +0
    -0
      v-2.5/vdrnfofs-0.8/.pc/debian-changes-0.7-1yavdr1~natty/vdrnfofs.egg-info/dependency_links.txt
  8. +0
    -0
      v-2.5/vdrnfofs-0.8/.pc/debian-changes-0.7-1yavdr1~natty/vdrnfofs.egg-info/top_level.txt
  9. +29
    -0
      v-2.5/vdrnfofs-0.8/COPYRIGHT
  10. +8
    -0
      v-2.5/vdrnfofs-0.8/DEVELOPERNOTES
  11. +27
    -0
      v-2.5/vdrnfofs-0.8/HISTORY
  12. +80
    -0
      v-2.5/vdrnfofs-0.8/README
  13. +2
    -0
      v-2.5/vdrnfofs-0.8/TODO
  14. +36
    -0
      v-2.5/vdrnfofs-0.8/bin/vdrnfofs
  15. +6
    -0
      v-2.5/vdrnfofs-0.8/debian/README.Debian
  16. +29
    -0
      v-2.5/vdrnfofs-0.8/debian/changelog
  17. +1
    -0
      v-2.5/vdrnfofs-0.8/debian/compat
  18. +14
    -0
      v-2.5/vdrnfofs-0.8/debian/control
  19. +37
    -0
      v-2.5/vdrnfofs-0.8/debian/copyright
  20. +62
    -0
      v-2.5/vdrnfofs-0.8/debian/patches/debian-changes-0.7-1yavdr1~natty
  21. +1
    -0
      v-2.5/vdrnfofs-0.8/debian/patches/series
  22. +13
    -0
      v-2.5/vdrnfofs-0.8/debian/rules
  23. +1
    -0
      v-2.5/vdrnfofs-0.8/debian/source/format
  24. +45
    -0
      v-2.5/vdrnfofs-0.8/setup.py
  25. +0
    -0
      v-2.5/vdrnfofs-0.8/tests/__init__.py
  26. +1
    -0
      v-2.5/vdrnfofs-0.8/tests/sample_video_dir/folder/sample1/2008-03-28.20.13.99.99.rec/001.vdr
  27. +1
    -0
      v-2.5/vdrnfofs-0.8/tests/sample_video_dir/folder/sample1/2008-03-28.20.13.99.99.rec/002.vdr
  28. +1
    -0
      v-2.5/vdrnfofs-0.8/tests/sample_video_dir/folder/sample1/2008-03-28.20.13.99.99.rec/003.vdr
  29. +1
    -0
      v-2.5/vdrnfofs-0.8/tests/sample_video_dir/folder/sample1/2008-03-28.20.13.99.99.rec/004.vdr
  30. +6
    -0
      v-2.5/vdrnfofs-0.8/tests/sample_video_dir/folder/sample1/2008-03-28.20.13.99.99.rec/info.vdr
  31. +1
    -0
      v-2.5/vdrnfofs-0.8/tests/sample_video_dir/folder/sample2/2008-03-28.20.13.99.98.rec/001.vdr
  32. +1
    -0
      v-2.5/vdrnfofs-0.8/tests/sample_video_dir/folder/sample2/2008-03-28.20.13.99.98.rec/002.vdr
  33. +1
    -0
      v-2.5/vdrnfofs-0.8/tests/sample_video_dir/folder/sample2/2008-03-28.20.13.99.98.rec/003.vdr
  34. +1
    -0
      v-2.5/vdrnfofs-0.8/tests/sample_video_dir/folder/sample2/2008-03-28.20.13.99.98.rec/004.vdr
  35. +6
    -0
      v-2.5/vdrnfofs-0.8/tests/sample_video_dir/folder/sample2/2008-03-28.20.13.99.98.rec/info.vdr
  36. +1
    -0
      v-2.5/vdrnfofs-0.8/tests/sample_video_dir/folder/sample2/2008-03-28.20.13.99.99.rec/001.vdr
  37. +1
    -0
      v-2.5/vdrnfofs-0.8/tests/sample_video_dir/folder/sample2/2008-03-28.20.13.99.99.rec/002.vdr
  38. +1
    -0
      v-2.5/vdrnfofs-0.8/tests/sample_video_dir/folder/sample2/2008-03-28.20.13.99.99.rec/003.vdr
  39. +1
    -0
      v-2.5/vdrnfofs-0.8/tests/sample_video_dir/folder/sample2/2008-03-28.20.13.99.99.rec/004.vdr
  40. +6
    -0
      v-2.5/vdrnfofs-0.8/tests/sample_video_dir/folder/sample2/2008-03-28.20.13.99.99.rec/info.vdr
  41. +1
    -0
      v-2.5/vdrnfofs-0.8/tests/sample_video_dir/sample-vdr1.7/2008-03-28.20.13.10-1.rec/00001.ts
  42. +1
    -0
      v-2.5/vdrnfofs-0.8/tests/sample_video_dir/sample-vdr1.7/2008-03-28.20.13.10-1.rec/00002.ts
  43. +1
    -0
      v-2.5/vdrnfofs-0.8/tests/sample_video_dir/sample-vdr1.7/2008-03-28.20.13.10-1.rec/00003.ts
  44. +1
    -0
      v-2.5/vdrnfofs-0.8/tests/sample_video_dir/sample-vdr1.7/2008-03-28.20.13.10-1.rec/00004.ts
  45. +6
    -0
      v-2.5/vdrnfofs-0.8/tests/sample_video_dir/sample-vdr1.7/2008-03-28.20.13.10-1.rec/info
  46. +1
    -0
      v-2.5/vdrnfofs-0.8/tests/sample_video_dir/sample/2008-03-28.20.13.99.99.rec/001.vdr
  47. +1
    -0
      v-2.5/vdrnfofs-0.8/tests/sample_video_dir/sample/2008-03-28.20.13.99.99.rec/002.vdr
  48. +1
    -0
      v-2.5/vdrnfofs-0.8/tests/sample_video_dir/sample/2008-03-28.20.13.99.99.rec/003.vdr
  49. +1
    -0
      v-2.5/vdrnfofs-0.8/tests/sample_video_dir/sample/2008-03-28.20.13.99.99.rec/004.vdr
  50. +6
    -0
      v-2.5/vdrnfofs-0.8/tests/sample_video_dir/sample/2008-03-28.20.13.99.99.rec/info.vdr
  51. +32
    -0
      v-2.5/vdrnfofs-0.8/tests/syslog.py
  52. +49
    -0
      v-2.5/vdrnfofs-0.8/tests/test_all
  53. +51
    -0
      v-2.5/vdrnfofs-0.8/tests/test_dir.py
  54. +85
    -0
      v-2.5/vdrnfofs-0.8/tests/test_gettattr.py
  55. +59
    -0
      v-2.5/vdrnfofs-0.8/tests/test_mpg.py
  56. +60
    -0
      v-2.5/vdrnfofs-0.8/tests/test_nfo.py
  57. +56
    -0
      v-2.5/vdrnfofs-0.8/tests/test_path_to_node_mapping.py
  58. +10
    -0
      v-2.5/vdrnfofs-0.8/vdrnfofs.egg-info/PKG-INFO
  59. +13
    -0
      v-2.5/vdrnfofs-0.8/vdrnfofs.egg-info/SOURCES.txt
  60. +1
    -0
      v-2.5/vdrnfofs-0.8/vdrnfofs.egg-info/dependency_links.txt
  61. +1
    -0
      v-2.5/vdrnfofs-0.8/vdrnfofs.egg-info/top_level.txt
  62. +0
    -0
      v-2.5/vdrnfofs-0.8/vdrnfofs/__init__.py
  63. +68
    -0
      v-2.5/vdrnfofs-0.8/vdrnfofs/concatenated_file_reader.py
  64. +250
    -0
      v-2.5/vdrnfofs-0.8/vdrnfofs/filesystemnodes.py
  65. +28
    -0
      v-2.5/vdrnfofs-0.8/vdrnfofs/nodecache.py
  66. +48
    -0
      v-2.5/vdrnfofs-0.8/vdrnfofs/vdr.py
  67. +162
    -0
      v-2.5/vdrnfofs-0.8/vdrnfofs/vdrnfofs.py

+ 1
- 0
v-2.5/vdrnfofs-0.8/.pc/.quilt_patches View File

@@ -0,0 +1 @@
debian/patches

+ 1
- 0
v-2.5/vdrnfofs-0.8/.pc/.quilt_series View File

@@ -0,0 +1 @@
series

+ 1
- 0
v-2.5/vdrnfofs-0.8/.pc/.version View File

@@ -0,0 +1 @@
2

+ 1
- 0
v-2.5/vdrnfofs-0.8/.pc/applied-patches View File

@@ -0,0 +1 @@
debian-changes-0.7-1yavdr1~natty

+ 0
- 0
v-2.5/vdrnfofs-0.8/.pc/debian-changes-0.7-1yavdr1~natty/vdrnfofs.egg-info/PKG-INFO View File


+ 0
- 0
v-2.5/vdrnfofs-0.8/.pc/debian-changes-0.7-1yavdr1~natty/vdrnfofs.egg-info/SOURCES.txt View File


+ 0
- 0
v-2.5/vdrnfofs-0.8/.pc/debian-changes-0.7-1yavdr1~natty/vdrnfofs.egg-info/dependency_links.txt View File


+ 0
- 0
v-2.5/vdrnfofs-0.8/.pc/debian-changes-0.7-1yavdr1~natty/vdrnfofs.egg-info/top_level.txt View File


+ 29
- 0
v-2.5/vdrnfofs-0.8/COPYRIGHT View File

@@ -0,0 +1,29 @@
Copyright 2010 Tobias Grimm <[email protected]> All rights reserved.

Software License Agreement (BSD License)

Redistribution and use of this software in source and binary forms, with or
without modification, are permitted provided that the following conditions
are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

* Neither the name of the author/copyright holder nor the names of contributors may
be used to endorse or promote products derived from this software without specific
prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

+ 8
- 0
v-2.5/vdrnfofs-0.8/DEVELOPERNOTES View File

@@ -0,0 +1,8 @@
Fuse might call read(...) on the file class from multiple threads, causing
a race condition with the underlying seek/read operations.

Using locking here seems to make the file access slower, than just disabling
the multithreading in Fuse with fs.multithreading = False.

A thread-local storage doesn't help either, because Fuse doesn't seem to
reuse threads, but might create new threads for each read operation.

+ 27
- 0
v-2.5/vdrnfofs-0.8/HISTORY View File

@@ -0,0 +1,27 @@
version 0.9
- Fixed typo in README (Closes #806)
- Added note to README, that it might be required to specify
the absolute path to vdrnfofs in /etc/fstab (Closes #807)

version 0.8
- Use cStringIO instead of string concatenation - about 3 times faster
(Patch provided by Ed Hein)
- Fixed license header in source files - it's the BSD licence now!
- Set mtime of file nodes to recording time (parsed from *.rec)
- Set mtime of dir nodes to original directories mtime
- Added homepage http://projects.vdr-developer.org/projects/vdrnfofs
- Some micro optimizations
- Cache the file system nodes user for get_stat() (nodes used for
reading are not cached)
- For FUSE file nodes' uid/gid is taken from the *.rec dir, for dir nodes
from the original dir

version 0.7
- Fixed file/dir node permissions
- Added README
- BSD Licence
- Added TODO and HISTORY
- Enable "./setup.py test" for running the tests

version 0.6
- inital release

+ 80
- 0
v-2.5/vdrnfofs-0.8/README View File

@@ -0,0 +1,80 @@
vdrnfofs
========

Copyright 2010 Tobias Grimm <[email protected]>

vdrnfos is released under the terms of the BSD License - see COPYRIGHT

http://projects.vdr-developer.org/projects/vdrnfofs


What's this about?
------------------

vdrnfofs creates a virtual Fuse-based file system that maps recordings
from the Linux Video Disc Recorder (VDR) to *.nfo and *.mpg files.

Those files can then e.g. be used by media center applications like.
XBMC or Enna.

Such a thing has been tried previously here:

http://code.google.com/p/vdrfs/

But this project seems to be abandoned, so I've started with vdrnfofs from
scratch.

VDR recordings (PS or TS) are simply mapped 1:1 to *.mpg files. If the VDR
recording is split to multiple files, they are virtually concatenated to a
single *.mpg file.

The *.nfo is a XML file with the follwing structure:

<movie>
<title>...</title>
<plot>...</plot>
</movie>

Title and plot are mapped from VDR's info file ('T' and 'D').


How to install?
---------------

In order to be able to use vdrnofs, python-setuptools and python-fuse are
required.

If not installing from a package of your preferred Linux distribution run:

./setup.py install

The user which should be able to mount vdrnfofs should be a member of the
group "fuse".


How to use?
-----------

To mount a vdrnfofs file system, run:

vdrnfofs <mount-point> -o video=<vdr-vide-dir>

e.g.:

vdrnfofs /mnt/vdrnfofs -o video=/var/lib/video

You can also do this in /etc/fstab with:

vdrnfofs /mnt/vdrnfofs fuse video=/var/lib/video 0 0

By default only the user that mounted the vdrnfos can also access it.
If you want system-wide access to the file system, you should mount it as root
and pass the option "allow_other" e.g.:

vdrnfofs /mnt/vdrnfofs -o video=/var/lib/video - o allow_other

If vdrnfofs is not in your path for root (Debian and Ubuntu most likely do not
include /usr/local/bin in the path), you might need to provide the full path
in fstab, like e.g.:

/usr/local/bin/vdrnfofs /mnt/vdrnfofs fuse video=/var/lib/video 0 0

+ 2
- 0
v-2.5/vdrnfofs-0.8/TODO View File

@@ -0,0 +1,2 @@
- Add option for translating to samba friendly path names
(especially ':')

+ 36
- 0
v-2.5/vdrnfofs-0.8/bin/vdrnfofs View File

@@ -0,0 +1,36 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# VDR-NFO-FS creates a file system for VDR recordings, which maps each
# recording to a single mpg-file and nfo-file containing some meta data.
#
# Copyright (c) 2010 - 2011 by Tobias Grimm
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of the author/copyright holder nor the names of
# contributors may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

import sys
from vdrnfofs import vdrnfofs

if __name__ == '__main__':
vdrnfofs.main()

+ 6
- 0
v-2.5/vdrnfofs-0.8/debian/README.Debian View File

@@ -0,0 +1,6 @@
vdrnfofs for Debian
-------------------

<possible notes regarding this package - if none, delete this file>

-- Tobias Grimm <[email protected]> Thu, 15 Apr 2010 23:32:55 +0200

+ 29
- 0
v-2.5/vdrnfofs-0.8/debian/changelog View File

@@ -0,0 +1,29 @@
vdrnfofs (0.8-2easyVDR0~trusty) trusty; urgency=high

* increase build number

-- Wolfgang Mangold <[email protected]> Fri, 05 May 2017 16:04:07 +0200

vdrnfofs (0.8-1easyVDR0~trusty) trusty; urgency=high

* * rebuild for trusty

-- Wolfgang Mangold <[email protected]> Fri, 05 May 2017 15:50:21 +0200

vdrnfofs (0.8-1easyVDR1~raring) raring; urgency=low

* add patch old vdr rec-dir struct

-- root <[email protected]> Tue, 12 Nov 2013 23:20:18 +0100

vdrnfofs (0.8-0easyVDR1~raring) raring; urgency=high

* rebuild

-- easyVDR-Developer <[email protected]> Wed, 30 Oct 2013 18:38:12 +0100

vdrnfofs (0.8-0easyVDR0~raring) raring; urgency=medium

* New Upstream Snapshot

-- easyVDR-Developer <[email protected]> Wed, 12 Oct 2011 09:44:07 +0200

+ 1
- 0
v-2.5/vdrnfofs-0.8/debian/compat View File

@@ -0,0 +1 @@
7

+ 14
- 0
v-2.5/vdrnfofs-0.8/debian/control View File

@@ -0,0 +1,14 @@
Source: vdrnfofs
Section: misc
Priority: extra
Maintainer: easyVDR-Developer <[email protected]>
Uploaders: Wolfgang Mangold <[email protected]>
Build-Depends: debhelper (>= 7.0.50)
Build-Depends-Indep: python-support, python-setuptools
Standards-Version: 3.8.4

Package: vdrnfofs
Architecture: all
Depends: ${misc:Depends}, python (>= 2.5), python-fuse
Description: vdrnfofs erstellt ein FUSE-basiertes virtuelles Dateisystem
vdrnfofs erstellt ein FUSE-basiertes virtuelles Dateisystem

+ 37
- 0
v-2.5/vdrnfofs-0.8/debian/copyright View File

@@ -0,0 +1,37 @@
This work was packaged for Debian by:

Tobias Grimm <[email protected]> on Thu, 15 Apr 2010 23:32:55 +0200

It was downloaded from:

<url://example.com>

Upstream Author(s):

<put author's name and email here>
<likewise for another author>

Copyright:

<Copyright (C) YYYY Firstname Lastname>
<likewise for another author>

License:

<Put the license of the package here indented by 4 spaces>

The Debian packaging is:

Copyright (C) 2010 Tobias Grimm <[email protected]>

# Please chose a license for your packaging work. If the program you package
# uses a mainstream license, using the same license is the safest choice.
# Please avoid to pick license terms that are more restrictive than the
# packaged work, as it may make Debian's contributions unacceptable upstream.
# If you just want it to be GPL version 3, leave the following lines in.

and is licensed under the GPL version 3,
see "/usr/share/common-licenses/GPL-3".

# Please also look if there are files or directories which have a
# different copyright/license attached and list them here.

+ 62
- 0
v-2.5/vdrnfofs-0.8/debian/patches/debian-changes-0.7-1yavdr1~natty View File

@@ -0,0 +1,62 @@
Description: Upstream changes introduced in version 0.7-1yavdr1~natty
This patch has been created by dpkg-source during the package build.
Here's the last changelog entry, hopefully it gives details on why
those changes were made:
.
vdrnfofs (0.7-1yavdr1~natty) natty; urgency=medium
.
* New upstream snapshot
.
The person named in the Author field signed this changelog entry.
Author: Gerald Dachs <[email protected]>

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: http://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>

--- /dev/null
+++ vdrnfofs-0.7/vdrnfofs.egg-info/SOURCES.txt
@@ -0,0 +1,12 @@
+README
+setup.py
+bin/vdrnfofs
+vdrnfofs/__init__.py
+vdrnfofs/concatenated_file_reader.py
+vdrnfofs/filesystemnodes.py
+vdrnfofs/vdr.py
+vdrnfofs/vdrnfofs.py
+vdrnfofs.egg-info/PKG-INFO
+vdrnfofs.egg-info/SOURCES.txt
+vdrnfofs.egg-info/dependency_links.txt
+vdrnfofs.egg-info/top_level.txt
\ No newline at end of file
--- /dev/null
+++ vdrnfofs-0.7/vdrnfofs.egg-info/PKG-INFO
@@ -0,0 +1,10 @@
+Metadata-Version: 1.0
+Name: vdrnfofs
+Version: 1.0
+Summary: Access VDR recordings as mpg and nfo files
+Home-page: UNKNOWN
+Author: Tobias Grimm
+Author-email: [email protected]
+License: BSD
+Description: UNKNOWN
+Platform: UNKNOWN
--- /dev/null
+++ vdrnfofs-0.7/vdrnfofs.egg-info/dependency_links.txt
@@ -0,0 +1 @@
+
--- /dev/null
+++ vdrnfofs-0.7/vdrnfofs.egg-info/top_level.txt
@@ -0,0 +1 @@
+vdrnfofs

+ 1
- 0
v-2.5/vdrnfofs-0.8/debian/patches/series View File

@@ -0,0 +1 @@
debian-changes-0.7-1yavdr1~natty

+ 13
- 0
v-2.5/vdrnfofs-0.8/debian/rules View File

@@ -0,0 +1,13 @@
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

%:
dh [email protected]

+ 1
- 0
v-2.5/vdrnfofs-0.8/debian/source/format View File

@@ -0,0 +1 @@
3.0 (native)

+ 45
- 0
v-2.5/vdrnfofs-0.8/setup.py View File

@@ -0,0 +1,45 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# VDR-NFO-FS creates a file system for VDR recordings, which maps each
# recording to a single mpg-file and nfo-file containing some meta data.
#
# Copyright (C) 2010 - 2011 by Tobias Grimm
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

import os
import re

from distutils.core import setup
from distutils.file_util import copy_file
from distutils.command.build_py import build_py
from distutils.command.install_data import install_data
from setuptools import setup, find_packages

from glob import glob
from subprocess import check_call

setup (
name='vdrnfofs',
version='1.0',
maintainer = "Tobias Grimm",
maintainer_email = "[email protected]",
description = "Access VDR recordings as mpg and nfo files",
license = "BSD",
scripts = ['bin/vdrnfofs'],
packages = ['vdrnfofs'],
test_suite = "tests",
)

+ 0
- 0
v-2.5/vdrnfofs-0.8/tests/__init__.py View File


+ 1
- 0
v-2.5/vdrnfofs-0.8/tests/sample_video_dir/folder/sample1/2008-03-28.20.13.99.99.rec/001.vdr View File

@@ -0,0 +1 @@
1234567890

+ 1
- 0
v-2.5/vdrnfofs-0.8/tests/sample_video_dir/folder/sample1/2008-03-28.20.13.99.99.rec/002.vdr View File

@@ -0,0 +1 @@
abcdefghij

+ 1
- 0
v-2.5/vdrnfofs-0.8/tests/sample_video_dir/folder/sample1/2008-03-28.20.13.99.99.rec/003.vdr View File

@@ -0,0 +1 @@
1234567890

+ 1
- 0
v-2.5/vdrnfofs-0.8/tests/sample_video_dir/folder/sample1/2008-03-28.20.13.99.99.rec/004.vdr View File

@@ -0,0 +1 @@
abcdefghij

+ 6
- 0
v-2.5/vdrnfofs-0.8/tests/sample_video_dir/folder/sample1/2008-03-28.20.13.99.99.rec/info.vdr View File

@@ -0,0 +1,6 @@
C S19.2E-1-1101-28112
E 6345 1189982700 18900 4E 10
T Movie Title
S Movie Subtitle
D A movie about something
X 2 03 deu stereo

+ 1
- 0
v-2.5/vdrnfofs-0.8/tests/sample_video_dir/folder/sample2/2008-03-28.20.13.99.98.rec/001.vdr View File

@@ -0,0 +1 @@
1234567890

+ 1
- 0
v-2.5/vdrnfofs-0.8/tests/sample_video_dir/folder/sample2/2008-03-28.20.13.99.98.rec/002.vdr View File

@@ -0,0 +1 @@
abcdefghij

+ 1
- 0
v-2.5/vdrnfofs-0.8/tests/sample_video_dir/folder/sample2/2008-03-28.20.13.99.98.rec/003.vdr View File

@@ -0,0 +1 @@
1234567890

+ 1
- 0
v-2.5/vdrnfofs-0.8/tests/sample_video_dir/folder/sample2/2008-03-28.20.13.99.98.rec/004.vdr View File

@@ -0,0 +1 @@
abcdefghij

+ 6
- 0
v-2.5/vdrnfofs-0.8/tests/sample_video_dir/folder/sample2/2008-03-28.20.13.99.98.rec/info.vdr View File

@@ -0,0 +1,6 @@
C S19.2E-1-1101-28112
E 6345 1189982700 18900 4E 10
T Movie Title
S Movie Subtitle
D A movie about something
X 2 03 deu stereo

+ 1
- 0
v-2.5/vdrnfofs-0.8/tests/sample_video_dir/folder/sample2/2008-03-28.20.13.99.99.rec/001.vdr View File

@@ -0,0 +1 @@
1234567890

+ 1
- 0
v-2.5/vdrnfofs-0.8/tests/sample_video_dir/folder/sample2/2008-03-28.20.13.99.99.rec/002.vdr View File

@@ -0,0 +1 @@
abcdefghij

+ 1
- 0
v-2.5/vdrnfofs-0.8/tests/sample_video_dir/folder/sample2/2008-03-28.20.13.99.99.rec/003.vdr View File

@@ -0,0 +1 @@
1234567890

+ 1
- 0
v-2.5/vdrnfofs-0.8/tests/sample_video_dir/folder/sample2/2008-03-28.20.13.99.99.rec/004.vdr View File

@@ -0,0 +1 @@
abcdefghij

+ 6
- 0
v-2.5/vdrnfofs-0.8/tests/sample_video_dir/folder/sample2/2008-03-28.20.13.99.99.rec/info.vdr View File

@@ -0,0 +1,6 @@
C S19.2E-1-1101-28112
E 6345 1189982700 18900 4E 10
T Movie Title
S Movie Subtitle
D A movie about something
X 2 03 deu stereo

+ 1
- 0
v-2.5/vdrnfofs-0.8/tests/sample_video_dir/sample-vdr1.7/2008-03-28.20.13.10-1.rec/00001.ts View File

@@ -0,0 +1 @@
1234567890

+ 1
- 0
v-2.5/vdrnfofs-0.8/tests/sample_video_dir/sample-vdr1.7/2008-03-28.20.13.10-1.rec/00002.ts View File

@@ -0,0 +1 @@
abcdefghij

+ 1
- 0
v-2.5/vdrnfofs-0.8/tests/sample_video_dir/sample-vdr1.7/2008-03-28.20.13.10-1.rec/00003.ts View File

@@ -0,0 +1 @@
1234567890

+ 1
- 0
v-2.5/vdrnfofs-0.8/tests/sample_video_dir/sample-vdr1.7/2008-03-28.20.13.10-1.rec/00004.ts View File

@@ -0,0 +1 @@
abcdefghij

+ 6
- 0
v-2.5/vdrnfofs-0.8/tests/sample_video_dir/sample-vdr1.7/2008-03-28.20.13.10-1.rec/info View File

@@ -0,0 +1,6 @@
C S19.2E-1-1101-28112
E 6345 1189982700 18900 4E 10
T Movie Title
S Movie Subtitle
D A movie about something
X 2 03 deu stereo

+ 1
- 0
v-2.5/vdrnfofs-0.8/tests/sample_video_dir/sample/2008-03-28.20.13.99.99.rec/001.vdr View File

@@ -0,0 +1 @@
1234567890

+ 1
- 0
v-2.5/vdrnfofs-0.8/tests/sample_video_dir/sample/2008-03-28.20.13.99.99.rec/002.vdr View File

@@ -0,0 +1 @@
abcdefghij

+ 1
- 0
v-2.5/vdrnfofs-0.8/tests/sample_video_dir/sample/2008-03-28.20.13.99.99.rec/003.vdr View File

@@ -0,0 +1 @@
1234567890

+ 1
- 0
v-2.5/vdrnfofs-0.8/tests/sample_video_dir/sample/2008-03-28.20.13.99.99.rec/004.vdr View File

@@ -0,0 +1 @@
abcdefghij

+ 6
- 0
v-2.5/vdrnfofs-0.8/tests/sample_video_dir/sample/2008-03-28.20.13.99.99.rec/info.vdr View File

@@ -0,0 +1,6 @@
C S19.2E-1-1101-28112
E 6345 1189982700 18900 4E 10
T Movie Title
S Movie Subtitle
D A movie about something
X 2 03 deu stereo

+ 32
- 0
v-2.5/vdrnfofs-0.8/tests/syslog.py View File

@@ -0,0 +1,32 @@
# -*- coding: utf-8 -*-
#
# VDR-NFO-FS creates a file system for VDR recordings, which maps each
# recording to a single mpg-file and nfo-file containing some meta data.
#
# Copyright (c) 2010 - 2011 by Tobias Grimm
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of the author/copyright holder nor the names of
# contributors may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

def syslog(*arg):
raise

+ 49
- 0
v-2.5/vdrnfofs-0.8/tests/test_all View File

@@ -0,0 +1,49 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# VDR-NFO-FS creates a file system for VDR recordings, which maps each
# recording to a single mpg-file and nfo-file containing some meta data.
#
# Copyright (c) 2010 - 2011 by Tobias Grimm
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of the author/copyright holder nor the names of
# contributors may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

import os
import sys
import unittest

def suite():
suite = unittest.TestSuite()
for _, _, files in os.walk('.'):
for name in filter(is_test, files):
tests = unittest.defaultTestLoader.loadTestsFromName(name[:-3])
suite.addTests(tests)
return suite

def is_test(filename):
return filename.startswith('test_') and filename.endswith('.py')

if __name__ == "__main__":
sys.path.insert(0, '.')
unittest.main(defaultTest="suite")

+ 51
- 0
v-2.5/vdrnfofs-0.8/tests/test_dir.py View File

@@ -0,0 +1,51 @@
# -*- coding: utf-8 -*-
#
# VDR-NFO-FS creates a file system for VDR recordings, which maps each
# recording to a single mpg-file and nfo-file containing some meta data.
#
# Copyright (c) 2010 - 2011 by Tobias Grimm
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of the author/copyright holder nor the names of
# contributors may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

import sys
import os
import unittest
import xml.etree.ElementTree

sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

from vdrnfofs.vdrnfofs import *

class TestDir(unittest.TestCase):
def setUp(self):
self.video = self.video_dir = os.path.abspath(os.path.dirname(__file__) + '/sample_video_dir')

def test_not_existing(self):
node = get_node(self.video, '/does_not_exist')
self.assertEqual(None, node)

def test_content(self):
node = get_node(self.video, '/')
self.assertEqual(5, len(node.content()))


+ 85
- 0
v-2.5/vdrnfofs-0.8/tests/test_gettattr.py View File

@@ -0,0 +1,85 @@
# -*- coding: utf-8 -*-
#
# VDR-NFO-FS creates a file system for VDR recordings, which maps each
# recording to a single mpg-file and nfo-file containing some meta data.
#
# Copyright (c) 2010 - 2011 by Tobias Grimm
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of the author/copyright holder nor the names of
# contributors may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

import sys
import os
import unittest
import stat
import datetime

sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))

from vdrnfofs.vdrnfofs import *

class TestPathToNodeMapping(unittest.TestCase):
def setUp(self):
self.fs = VdrNfoFs()
self.fs.video = self.video_dir = os.path.abspath(os.path.dirname(__file__) + '/sample_video_dir')
time_stamp = time.mktime(datetime.datetime(2011,1,1,11,11).timetuple())
os.utime(self.fs.video, (time_stamp, time_stamp))
os.utime(self.fs.video + '/folder', (time_stamp, time_stamp))

def test_root(self):
attr = self.fs.getattr('/')
self.assertEqual(stat.S_IFDIR | 0555, attr.st_mode)
self.assertEqual(datetime.datetime(2011,1,1,11,11), datetime.datetime.fromtimestamp(attr.st_mtime))
self.assertEqual(os.lstat(self.fs.video).st_uid, attr.st_uid)
self.assertEqual(os.lstat(self.fs.video).st_gid, attr.st_gid)
self.assertEqual(2 + 5, attr.st_nlink)

def test_dir(self):
attr = self.fs.getattr('/folder')
self.assertEqual(stat.S_IFDIR | 0555, attr.st_mode)
self.assertEqual(datetime.datetime(2011,1,1,11,11), datetime.datetime.fromtimestamp(attr.st_mtime))
self.assertEqual(os.lstat(self.fs.video + '/folder').st_uid, attr.st_uid)
self.assertEqual(os.lstat(self.fs.video + '/folder').st_gid, attr.st_gid)
self.assertEqual(2 + 6, attr.st_nlink)

def test_mpg(self):
attr = self.fs.getattr('/sample_2008-03-28.20.13.99.99.rec.mpg')
self.assertEqual(stat.S_IFREG | 0444, attr.st_mode)
self.assertEqual(datetime.datetime(2008,3,28,20,13), datetime.datetime.fromtimestamp(attr.st_mtime))
self.assertEqual(os.lstat(self.fs.video + '/sample/2008-03-28.20.13.99.99.rec').st_uid, attr.st_uid)
self.assertEqual(os.lstat(self.fs.video + '/sample/2008-03-28.20.13.99.99.rec').st_gid, attr.st_gid)

def test_nfo(self):
attr = self.fs.getattr('/sample_2008-03-28.20.13.99.99.rec.nfo')
self.assertEqual(stat.S_IFREG | 0444, attr.st_mode)
self.assertEqual(datetime.datetime(2008,3,28,20,13), datetime.datetime.fromtimestamp(attr.st_mtime))
self.assertEqual(os.lstat(self.fs.video + '/sample/2008-03-28.20.13.99.99.rec').st_uid, attr.st_uid)
self.assertEqual(os.lstat(self.fs.video + '/sample/2008-03-28.20.13.99.99.rec').st_gid, attr.st_gid)

def test_nfo_new(self):
attr = self.fs.getattr('/sample-vdr1.7_2008-03-28.20.13.10-1.rec.nfo')
self.assertEqual(stat.S_IFREG | 0444, attr.st_mode)
self.assertEqual(datetime.datetime(2008,3,28,20,13), datetime.datetime.fromtimestamp(attr.st_mtime))
self.assertEqual(os.lstat(self.fs.video + '/sample/2008-03-28.20.13.99.99.rec').st_uid, attr.st_uid)
self.assertEqual(os.lstat(self.fs.video + '/sample/2008-03-28.20.13.99.99.rec').st_gid, attr.st_gid)

+ 59
- 0
v-2.5/vdrnfofs-0.8/tests/test_mpg.py View File

@@ -0,0 +1,59 @@
# -*- coding: utf-8 -*-
#
# VDR-NFO-FS creates a file system for VDR recordings, which maps each
# recording to a single mpg-file and nfo-file containing some meta data.
#
# Copyright (c) 2010 - 2011 by Tobias Grimm
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of the author/copyright holder nor the names of
# contributors may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

import sys
import os
import unittest
import xml.etree.ElementTree

sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

from vdrnfofs.vdrnfofs import *

class TestMpg(unittest.TestCase):
def setUp(self):
self.video = self.video_dir = os.path.abspath(os.path.dirname(__file__) + '/sample_video_dir')

def test_not_existing(self):
node = get_node(self.video, '/does_not_exist_2008-03-28.20.13.99.99.rec.mpg')
self.assertEqual(None, node)

def test_mpg(self):
node = get_node(self.video, '/sample_2008-03-28.20.13.99.99.rec.mpg')
self.assertEqual('sample_2008-03-28.20.13.99.99.rec.mpg', node.file_system_name())
self.assertEqual(40, node.size())
self.assertEqual('1234567890abcdefghij1234567890abcdefghij', node.read(0, 4096))

def test_mpg_new(self):
node = get_node(self.video, '/sample-vdr1.7_2008-03-28.20.13.10-1.rec.mpg')
self.assertEqual('sample-vdr1.7_2008-03-28.20.13.10-1.rec.mpg', node.file_system_name())
self.assertEqual(40, node.size())
self.assertEqual('1234567890abcdefghij1234567890abcdefghij', node.read(0, 4096))


+ 60
- 0
v-2.5/vdrnfofs-0.8/tests/test_nfo.py View File

@@ -0,0 +1,60 @@
# -*- coding: utf-8 -*-
#
# VDR-NFO-FS creates a file system for VDR recordings, which maps each
# recording to a single mpg-file and nfo-file containing some meta data.
#
# Copyright (c) 2010 - 2011 by Tobias Grimm
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of the author/copyright holder nor the names of
# contributors may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

import sys
import os
import unittest
import xml.etree.ElementTree

sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

from vdrnfofs.vdrnfofs import *

class TestNfo(unittest.TestCase):
def setUp(self):
self.video = self.video_dir = os.path.abspath(os.path.dirname(__file__) + '/sample_video_dir')

def test_not_existing(self):
node = get_node(self.video, '/does_not_exist_2008-03-28.20.13.99.99.rec.nfo')
self.assertEqual(None, node)

def test_nfo(self):
node = get_node(self.video, '/sample_2008-03-28.20.13.99.99.rec.nfo')
nfo = xml.etree.ElementTree.fromstring(node.read(0, 4096))
self.assertEqual('sample_2008-03-28.20.13.99.99.rec.nfo', node.file_system_name())
self.assertEqual('Movie Title', nfo.find('title').text)
self.assertEqual('A movie about something', nfo.find('plot').text)

def test_nfo_new(self):
node = get_node(self.video, '/sample-vdr1.7_2008-03-28.20.13.10-1.rec.nfo')
nfo = xml.etree.ElementTree.fromstring(node.read(0, 4096))
self.assertEqual('sample-vdr1.7_2008-03-28.20.13.10-1.rec.nfo', node.file_system_name())
self.assertEqual('Movie Title', nfo.find('title').text)
self.assertEqual('A movie about something', nfo.find('plot').text)

+ 56
- 0
v-2.5/vdrnfofs-0.8/tests/test_path_to_node_mapping.py View File

@@ -0,0 +1,56 @@
# -*- coding: utf-8 -*-
#
# VDR-NFO-FS creates a file system for VDR recordings, which maps each
# recording to a single mpg-file and nfo-file containing some meta data.
#
# Copyright (c) 2010 - 2011 by Tobias Grimm
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of the author/copyright holder nor the names of
# contributors may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

import sys
import os
import unittest

sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

from vdrnfofs.vdrnfofs import *

class TestPathToNodeMapping(unittest.TestCase):
def setUp(self):
self.video = os.path.abspath(os.path.dirname(__file__) + '/sample_video_dir')

def test_root(self):
node = get_node(self.video, '/')
self.assertEqual('', node.file_system_name())
self.assertEqual(self.video + '/', node.path)

def test_subdir(self):
node = get_node(self.video, '/folder')
self.assertEqual('folder', node.file_system_name())
self.assertEqual(self.video + '/folder', node.path)

def test_mpg(self):
node = get_node(self.video, '/sample_2008-03-28.20.13.99.99.rec.mpg')
self.assertEqual('sample_2008-03-28.20.13.99.99.rec.mpg', node.file_system_name())
self.assertEqual(self.video + '/sample/2008-03-28.20.13.99.99.rec', node.path)

+ 10
- 0
v-2.5/vdrnfofs-0.8/vdrnfofs.egg-info/PKG-INFO View File

@@ -0,0 +1,10 @@
Metadata-Version: 1.0
Name: vdrnfofs
Version: 1.0
Summary: Access VDR recordings as mpg and nfo files
Home-page: UNKNOWN
Author: Tobias Grimm
Author-email: [email protected]
License: BSD
Description: UNKNOWN
Platform: UNKNOWN

+ 13
- 0
v-2.5/vdrnfofs-0.8/vdrnfofs.egg-info/SOURCES.txt View File

@@ -0,0 +1,13 @@
README
setup.py
bin/vdrnfofs
vdrnfofs/__init__.py
vdrnfofs/concatenated_file_reader.py
vdrnfofs/filesystemnodes.py
vdrnfofs/nodecache.py
vdrnfofs/vdr.py
vdrnfofs/vdrnfofs.py
vdrnfofs.egg-info/PKG-INFO
vdrnfofs.egg-info/SOURCES.txt
vdrnfofs.egg-info/dependency_links.txt
vdrnfofs.egg-info/top_level.txt

+ 1
- 0
v-2.5/vdrnfofs-0.8/vdrnfofs.egg-info/dependency_links.txt View File

@@ -0,0 +1 @@


+ 1
- 0
v-2.5/vdrnfofs-0.8/vdrnfofs.egg-info/top_level.txt View File

@@ -0,0 +1 @@
vdrnfofs

+ 0
- 0
v-2.5/vdrnfofs-0.8/vdrnfofs/__init__.py View File


+ 68
- 0
v-2.5/vdrnfofs-0.8/vdrnfofs/concatenated_file_reader.py View File

@@ -0,0 +1,68 @@
# -*- coding: utf-8 -*-
#
# VDR-NFO-FS creates a file system for VDR recordings, which maps each
# recording to a single mpg-file and nfo-file containing some meta data.
#
# Copyright (c) 2010 - 2011 by Tobias Grimm
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of the author/copyright holder nor the names of
# contributors may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

import os
from cStringIO import StringIO

class ConcatenatedFileReader:
def __init__(self, filenames):
self.files = [(f, os.path.getsize(f)) for f in filenames]
self.current_filename = None
self.current_file = None

def read(self, offset, size):
buffer = StringIO()
ptr = offset
while (buffer.tell() < size):
(filename, file_offset) = self.filename_from_offset(ptr)
if filename:
if (self.current_filename != filename):
if self.current_file:
self.current_file.close()
self.current_filename = filename
self.current_file = open(filename, 'r')
self.current_file.seek(file_offset)
buffer.write(self.current_file.read(size - buffer.tell()))
ptr = offset + buffer.tell()
else:
break
return buffer.getvalue()

def release(self):
if self.current_file:
self.current_file.close()

def filename_from_offset(self, offset):
for (filename, size) in self.files:
if offset >= size:
offset -= size
else:
return (filename, offset)
return (None, 0)

+ 250
- 0
v-2.5/vdrnfofs-0.8/vdrnfofs/filesystemnodes.py View File

@@ -0,0 +1,250 @@
# -*- coding: utf-8 -*-
#
# VDR-NFO-FS creates a file system for VDR recordings, which maps each
# recording to a single mpg-file and nfo-file containing some meta data.
#
# Copyright (c) 2010 - 2011 by Tobias Grimm
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of the author/copyright holder nor the names of
# contributors may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

import glob
import os
import fuse
import stat
import datetime
import time
import re

from concatenated_file_reader import *
from vdr import *

class FileNode(object):
def __init__(self, path, extension):
self.path = path
self._file_system_name = None
self.extension = extension

def file_system_name(self):
if not self._file_system_name:
self._file_system_name = '_'.join(self.path.rsplit('/', 3)[-2:]) + '.' + self.extension
return self._file_system_name

def get_stat(self):
orig = os.lstat(self.path)
attr = fuse.Stat()
attr.st_mode = stat.S_IFREG | stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH
attr.st_nlink = 1
attr.st_size = self.size()
timevalues = self.path.rsplit('/', 1)[1][:16].replace('.', '-').replace(':', '-').split('-')
attr.st_mtime = time.mktime(datetime.datetime(*[ int(s) for s in timevalues ]).timetuple())
attr.st_uid = orig.st_uid
attr.st_gid = orig.st_gid
return attr

class MpgNode(FileNode):
def __init__(self, path):
super(MpgNode, self).__init__(path, 'mpg')
self._mpeg_files = None
self._reader = None

def mpeg_files(self):
if not self._mpeg_files:
self._mpeg_files = glob.glob(self.path + '/[0-9]*.ts')
if not self._mpeg_files:
self._mpeg_files = glob.glob(self.path + '/[0-9]*.vdr')
self._mpeg_files.sort()
return self._mpeg_files

def reader(self):
if not self._reader:
self._reader = ConcatenatedFileReader(self.mpeg_files())
return self._reader

def size(self):
size = 0
for file in self.mpeg_files():
size += os.path.getsize(file)
return size

def read(self, offset, size):
return self.reader().read(offset, size)

def release(self):
if self._reader:
self._reader.release()


class NfoNode(FileNode):
def __init__(self, path):
super(NfoNode, self).__init__(path, 'nfo')
self._nfo_content = None

def nfo_content(self):
if not self._nfo_content:
info_path = self.path + '/info'
if not os.path.exists(info_path):
info_path = self.path + '/info.vdr'
if not os.path.exists(info_path):
info_path = self.path + '/summary.vdr'
if not os.path.exists(info_path):
info_path = None
info_vdr = InfoVdr(info_path)
self._nfo_content = """<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<movie>
<title>%s</title>
<plot>%s</plot>
</movie>
""" % (info_vdr['T'], info_vdr['D'])
return self._nfo_content

def size(self):
return len(self.nfo_content())

def read(self, offset, size):
return self.nfo_content()[offset:offset+size]

def release(self):
pass
class EdlNode(FileNode):
def __init__(self, path):
super(EdlNode, self).__init__(path, 'edl')
self._edl_content = None
self.timecode = re.compile('^(\d+:+)+\d+(.\d+)')
self.nullcode = re.compile("^(0+:)*0+(.+0+)$")

def edl_content(self):
if not self._edl_content:
self._edl_content = '00:00:00.000 99:99:99.99 2'
info_path = self.path + '/info'
if not os.path.exists(info_path):
info_path = self.path + '/info.vdr'
if not os.path.exists(info_path):
info_path = None
info_vdr = InfoVdr(info_path)
marks_path = self.path + '/marks'
if not os.path.exists(marks_path):
marks_path = self.path + '/marks.vdr'
if not os.path.exists(marks_path):
marks_path = None
if marks_path != None:
with open(marks_path,'r') as marks_vdr:
marks = marks_vdr.readlines()
matches = []
for mark in marks:
a = self.timecode.search(mark)
if a:
MARKS_FORMAT = re.compile(r'^((\d+):(\d+):(\d+)\.?)?(\d*[1-9]\d*)?')
def mark_to_frame(mark, fps):
m = MARKS_FORMAT.match(mark)
if not m or not m.group():
return None
frame = int(m.group(5)) - 1 if m.group(5) else 0
if m.group(1):
hms = map(int, m.group(2, 3, 4))
frame += (hms[0] * 3600 + hms[1] * 60 + hms[2]) * fps
return frame
try:
tcms = 1000* int(ff)/int(info_vdr['F'])
matches.append("%s%3d"%(hms,int(tcms)))
except:
matches.append(a.group(0))

if self.nullcode.match(matches[0]):
# starts at 0
start = 0
else:
matches.insert(0,"00:00:00.000")
start = 1
matches.append("99:99:99.99")
edl_list = []
for i in xrange(0,len(matches)-1,1):
if i % 2 == 0:
if start == 1:
mode = "3"
else:
mode = "2"
edl_list.append("%s %s %s"%(matches[i],matches[i+1],mode))
else:
if start == 1:
mode = "2"
else:
mode = "3"
edl_list.append("%s %s %s"%(matches[i],matches[i+1],mode))
self._edl_content = "\n".join(edl_list)
return self._edl_content
def size(self):
return len(self.edl_content())

def read(self, offset, size):
return self.edl_content()[offset:offset+size]

def release(self):
pass

class DirNode:
def __init__(self, path):
self.path = path
self.cache = []
self._file_system_name = None

def file_system_name(self):
if not self._file_system_name:
self._file_system_name = self.path.rsplit('/',1)[1]
return self._file_system_name

def content(self):
if not self.cache:
for entry in os.listdir(self.path):
entry = self.path + '/' + entry
if self.is_sub_folder(entry):
self.cache.append(DirNode(entry))
for recording in glob.glob(entry + '/*.rec'):
if os.path.exists(recording + '/info.vdr') or os.path.exists(recording + '/info') or os.path.exists(recording + '/summary.vdr'):
self.cache.append(MpgNode(recording))
self.cache.append(NfoNode(recording))
self.cache.append(EdlNode(recording))
return self.cache

def is_sub_folder(self, dir):
if not os.path.isdir(dir):
return False
if dir.endswith('.rec'):
return False
for entry in os.listdir(dir):
if not entry.endswith('.rec'):
return True
return False

def get_stat(self):
orig = os.lstat(self.path)
attr = fuse.Stat()
attr.st_mode = stat.S_IFDIR | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH | stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH
attr.st_nlink = 2 + len(self.content())
attr.st_mtime = orig.st_mtime
attr.st_atime = orig.st_atime
attr.st_ctime = orig.st_ctime
attr.st_uid = orig.st_uid
attr.st_gid = orig.st_gid
return attr

+ 28
- 0
v-2.5/vdrnfofs-0.8/vdrnfofs/nodecache.py View File

@@ -0,0 +1,28 @@
import time

class NodeCache:
class CacheEntry:
def __init__(self, node):
self.time = time.time()
self.node = node

def __init__(self):
self.cache = {}
self.last_clean = time.time()

def get(self, path, creator):
#
# !!! It might be nicer to have a thread for cleaning the cache, but
# with the Fuse option multithreaded = False, threading seems to
# be totally impossible. Somehow Fuse blocks ALL threads.
#
now = time.time()
if (now - self.last_clean) > 15:
self.cache = dict((k, v) for k, v in self.cache.items() if (now - v.time) <= 10)
self.last_clean = now

cache_entry = self.cache.get(path, None)
if not cache_entry or (now - cache_entry.time) > 10:
cache_entry = NodeCache.CacheEntry(creator(path))
self.cache[path] = cache_entry
return cache_entry.node

+ 48
- 0
v-2.5/vdrnfofs-0.8/vdrnfofs/vdr.py View File

@@ -0,0 +1,48 @@
# -*- coding: utf-8 -*-
#
# VDR-NFO-FS creates a file system for VDR recordings, which maps each
# recording to a single mpg-file and nfo-file containing some meta data.
#
# Copyright (c) 2010 - 2011 by Tobias Grimm
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of the author/copyright holder nor the names of
# contributors may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

class InfoVdr:
def __init__(self, filename = None):
self.values = {'T' : 'Unknown', 'D': 'No Description'}
if filename:
isOldFormat = filename.endswith('summary.vdr')
with open(filename, 'r') as file:
if isOldFormat:
lines = file.readlines()
if len(lines) > 0:
self.values['T'] = lines[0].rstrip("\r\n")
self.values['D'] = ' '.join([l.rstrip("\r\n") for l in lines[1:]])
else:
for line in file:
line = line.rstrip("\r\n")
self.values[line[0]] = line[2:]

def __getitem__(self, key):
return self.values[key] if self.values.has_key(key) else ''

+ 162
- 0
v-2.5/vdrnfofs-0.8/vdrnfofs/vdrnfofs.py View File

@@ -0,0 +1,162 @@
# -*- coding: utf-8 -*-
#
# VDR-NFO-FS creates a file system for VDR recordings, which maps each
# recording to a single mpg-file and nfo-file containing some meta data.
#
# Copyright (c) 2010 - 2011 by Tobias Grimm
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of the author/copyright holder nor the names of
# contributors may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

import os
import stat
import errno
import sys
import fuse
import traceback
import logging

from concatenated_file_reader import *
from vdr import *
from filesystemnodes import *
from nodecache import *

fuse.fuse_python_api = (0, 2)

def format_exception_info(level = 6):
error_type, error_value, trbk = sys.exc_info()
tb_list = traceback.format_tb(trbk, level)
return 'Error: %s \nDescription: %s \nTraceback: %s' % (error_type.__name__, error_value, '\n'.join(tb_list))

def get_node(video, path):
virtual_path, virtual_file_extension = os.path.splitext(path)
if virtual_file_extension in ['.mpg', '.nfo', '.edl']:
p = virtual_path.rfind('_')
if p > 0:
video_path = '/'.join((video, virtual_path[1:p], virtual_path[p+1:]))
if not os.path.isdir(video_path):
return None
elif virtual_file_extension == '.mpg':
return MpgNode(video_path)
elif virtual_file_extension == '.nfo':
return NfoNode(video_path)
elif virtual_file_extension == '.edl':
return EdlNode(video_path)
else:
dir = video + path
if os.path.isdir(dir):
return DirNode(dir)
return None

class VdrNfoFsFile:
def __init__(self, path, flags, *mode):
self.path = path
self.node = get_node(VdrNfoFsFile.video_root, path)
self.keep_cache = True
self.direct_io = False

def read(self, size, offset):
try:
if not self.node:
return -errno.ENOENT
return self.node.read(offset, size)
except:
logging.error('VdrFuseFs: Unexpected error for read(%s): %s, %s' % (self.path, format_exception_info()))

def release(self, flags):
self.node.release()

# def write(self, buf, offset):
# return 0

# def _fflush(self):
# if 'w' in self.file.mode or 'a' in self.file.mode:
# self.file.flush()

# def fsync(self, isfsyncfile):

# def flush(self):

# def fgetattr(self):
# return 0

# def ftruncate(self, len):

# def lock(self, cmd, owner, **kw):


class VdrNfoFs(fuse.Fuse):
def __init__(self, *args, **kw):
fuse.Fuse.__init__(self, *args, **kw)
self.video = ''
self.log = ''
self.loglevel = 'info'
self.cache = NodeCache()

def getattr(self, path):
try:
node = self.cache.get(path, lambda x: get_node(self.video, x))
if node:
return node.get_stat()
return -errno.ENOENT
except:
logging.error('VdrFuseFs: Unexpected error for getattr(%s): %s' % (path, format_exception_info()))

def readdir(self, path, offset):
try:
yield fuse.Direntry('.')
yield fuse.Direntry('..')
node = self.cache.get(path, lambda x: get_node(self.video, x))
if node:
for item in node.content():
yield fuse.Direntry(item.file_system_name())
except:
logging.error('VdrFuseFs: Unexpected error for readdir(%s): %s' % (path, format_exception_info()))

def main(self, *a, **kw):
if self.log and self.log != None:
logging.basicConfig(filename=self.log, level=getattr(logging, self.loglevel.upper()))
else:
logging.basicConfig(level=self.loglevel.upper())
logging.info('Starting vdrnfofs')

VdrNfoFsFile.video_root = self.video
self.file_class = VdrNfoFsFile
return fuse.Fuse.main(self, *a, **kw)

def main():
usage = "\nVDR-NFO-FS - access VDR recordings as mpg and nfo files\n"
usage += fuse.Fuse.fusage

version = "%prog " + fuse.__version__

fs = VdrNfoFs(version=version, usage=usage, dash_s_do='setsingle')
fs.multithreaded = False
fs.parser.add_option(mountopt="video", default='', help="The video directory containing the VDR recordings")
fs.parser.add_option(mountopt="log", default='', help="The log file (default = console)")
fs.parser.add_option(mountopt="loglevel", default='info', help="The log level (debug, info, warning or error)")
fs.parse(values=fs, errex=1)
fs.main()

if __name__ == '__main__':
main()

Loading…
Cancel
Save