forked from samba-team/samba
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
media_harmony VFS module: Add and build by default.
- Supersedes previous patch. - Added various fixes for fake mtime functionality. - Now requires lp_cache_locked_write_times patch (bug 8912). - Removed various xattr functions to comply with recent VFS changes. - Changed SMB_STRUCT_DIR to DIR and SMB_STRUCT_DIRENT to struct dirent to comply with recent VFS changes. - Added manpage. - Added sample trigger_avid_update.py script. Autobuild-User(master): Björn Jacke <[email protected]> Autobuild-Date(master): Tue Aug 7 15:16:39 CEST 2012 on sn-devel-104
- Loading branch information
Showing
6 changed files
with
2,691 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
<?xml version="1.0" encoding="iso-8859-1"?> | ||
<!DOCTYPE refentry PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc"> | ||
<refentry id="vfs_media_harmony.8"> | ||
|
||
<refmeta> | ||
<refentrytitle>vfs_media_harmony</refentrytitle> | ||
<manvolnum>8</manvolnum> | ||
<refmiscinfo class="source">Samba</refmiscinfo> | ||
<refmiscinfo class="manual">System Administration tools</refmiscinfo> | ||
<refmiscinfo class="version">3.6</refmiscinfo> | ||
</refmeta> | ||
|
||
|
||
<refnamediv> | ||
<refname>vfs_media_harmony</refname> | ||
<refpurpose>Allow multiple Avid clients to share a network drive.</refpurpose> | ||
</refnamediv> | ||
|
||
<refsynopsisdiv> | ||
<cmdsynopsis> | ||
<command>vfs objects = media_harmony</command> | ||
</cmdsynopsis> | ||
</refsynopsisdiv> | ||
|
||
<refsect1> | ||
<title>DESCRIPTION</title> | ||
|
||
<para>This VFS module is part of the | ||
<citerefentry><refentrytitle>samba</refentrytitle> | ||
<manvolnum>7</manvolnum></citerefentry> suite.</para> | ||
|
||
<para>The <command>vfs_media_harmony</command> VFS module allows | ||
Avid editorial workstations to share a network drive. It does | ||
this by:</para> | ||
<orderedlist continuation="restarts" inheritnum="ignore" numeration="arabic"> | ||
<listitem><para>Giving each client their own copy of the Avid | ||
msmMMOB.mdb and msmFMID.pmr files and Creating directories.</para></listitem> | ||
<listitem><para>Allowing each client to explicitly control the | ||
write time the Avid application sees on Avid media directories.</para></listitem> | ||
</orderedlist> | ||
|
||
<para>This module is stackable.</para> | ||
|
||
</refsect1> | ||
|
||
<refsect1> | ||
<title>CONFIGURATION</title> | ||
|
||
<para><command>vfs_media_harmony</command> automatically redirects | ||
requests from clients for Avid database files or an Avid Creating | ||
directory to a client-specific version of the file. No | ||
configuration beyond enabling the module is needed to get this | ||
portion of its functionality working.</para> | ||
|
||
<para>If Mac and Windows Avid clients will be accessing the same | ||
folder, they should be given separate share definitions, with | ||
hidden Mac files vetoed on the Windows share. See EXAMPLES.</para> | ||
|
||
<para>To allow each client to control when the Avid application | ||
refreshes their Avid databases, create files for each client | ||
and each Avid media directory with the name | ||
[avid_dir_name]_[client_ip_address]_[client_username]. | ||
To trigger Avid database refreshes, update the write time on | ||
those files. See EXAMPLES.</para> | ||
|
||
<para>It is also necessary for the <command>cache locked write times = no</command> | ||
option to be set for clients to be able to control their Avid | ||
media folder write times.</para> | ||
|
||
</refsect1> | ||
|
||
<refsect1> | ||
<title>EXAMPLES</title> | ||
|
||
<para>Enable media_harmony for Mac and Windows clients:</para> | ||
<programlisting> | ||
<smbconfsection name="[avid_mac]"/> | ||
<smbconfoption name="path">/avid</smbconfoption> | ||
<smbconfoption name="vfs objects">media_harmony</smbconfoption> | ||
<smbconfoption name="cache locked write times">no</smbconfoption> | ||
<smbconfsection name="[avid_win]"/> | ||
<smbconfoption name="path">/avid</smbconfoption> | ||
<smbconfoption name="vfs objects">media_harmony</smbconfoption> | ||
<smbconfoption name="cache locked write times">no</smbconfoption> | ||
<smbconfoption name="veto files">/.DS_Store/._@/.Trash@/.Spotlight@/.hidden/.hotfiles@/.vol/</smbconfoption> | ||
<smbconfoption name="delete veto files">yes</smbconfoption> | ||
</programlisting> | ||
|
||
<para>Create the files that will allow users david and susan | ||
to control their own Avid database refreshes:</para> | ||
<programlisting> | ||
touch '/avid/OMFI MediaFiles_192.168.1.10_david' \ | ||
'/avid/OMFI MediaFiles_192.168.1.11_susan' \ | ||
'/avid/Avid MediaFiles/MXF/1_192.168.1.10_david' \ | ||
'/avid/Avid MediaFiles/MXF/1_192.168.1.11_susan' | ||
</programlisting> | ||
<para>Trigger an Avid database refresh for user david:</para> | ||
<programlisting> | ||
touch '/avid/OMFI MediaFiles_192.168.1.10_david' \ | ||
'/avid/Avid MediaFiles/MXF/1_192.168.1.10_david' | ||
</programlisting> | ||
|
||
<para>If you have a large number of Avid media folders to manage, | ||
you can give each editor a suitably modified version of | ||
examples/scripts/vfs/media_harmony/trigger_avid_update.py to | ||
create and update these files.</para> | ||
|
||
</refsect1> | ||
|
||
<refsect1> | ||
<title>CAVEATS</title> | ||
|
||
<para><command>vfs_media_harmony</command> is designed to work with | ||
Avid editing applications that look in the Avid MediaFiles or | ||
OMFI MediaFiles directories for media. It is not designed to work | ||
as expected in all circumstances for general use. For example: It | ||
is possible to open a client-specific file such as | ||
msmMMOB.mdb_192.168.1.10_userx even though it doesn't show up | ||
in a directory listing.</para> | ||
|
||
</refsect1> | ||
|
||
|
||
|
||
<refsect1> | ||
<title>VERSION</title> | ||
|
||
<para>This man page is correct for version 3.2.7 of the Samba suite. | ||
</para> | ||
</refsect1> | ||
|
||
<refsect1> | ||
<title>AUTHOR</title> | ||
|
||
<para>The original Samba software and related utilities | ||
were created by Andrew Tridgell. Samba is now developed | ||
by the Samba Team as an Open Source project similar | ||
to the way the Linux kernel is developed.</para> | ||
|
||
</refsect1> | ||
|
||
</refentry> |
103 changes: 103 additions & 0 deletions
103
examples/scripts/vfs/media_harmony/trigger_avid_update.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
#!/usr/bin/python | ||
import os, socket, sys, stat | ||
|
||
###################################################################### | ||
## | ||
## trigger_avid_update.py for media_harmony VFS module. | ||
## | ||
## Copyright (C) Andrew Klaassen 2012. | ||
## | ||
## 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 3 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, see <http://www.gnu.org/licenses/>. | ||
## | ||
###################################################################### | ||
|
||
|
||
# | ||
# Change avid_shares and ip_prefix as appropriate for your network. | ||
# | ||
|
||
avid_shares = ( | ||
'\\\\mediaharmony01\\project1\\', | ||
'\\\\mediaharmony01\\project2\\', | ||
'\\\\mediaharmony01\\project3\\', | ||
) | ||
|
||
ip_prefix = '192.168.1.' | ||
|
||
|
||
if __name__ == "__main__": | ||
my_ips = [ip for ip in socket.gethostbyname_ex(socket.gethostname())[2] if ip[:len(ip_prefix)] == ip_prefix] | ||
if not my_ips: | ||
print 'No IP address found. Aborting.' | ||
dummy = raw_input("\nPress Enter to finish: ") | ||
sys.exit() | ||
|
||
my_ip = my_ips[0] | ||
my_name = os.environ.get('USERNAME') | ||
|
||
for avid_share in avid_shares: | ||
media_dirs = [] | ||
omfi_dir = os.path.join(avid_share, 'OMFI MediaFiles') | ||
if os.path.exists(omfi_dir): | ||
media_dirs.append(omfi_dir) | ||
mxf_root = os.path.join(avid_share, 'Avid MediaFiles', 'MXF') | ||
if os.path.exists(mxf_root): | ||
mxf_children = os.listdir(mxf_root) | ||
for child in mxf_children: | ||
fullpath = os.path.join(mxf_root, child) | ||
if os.path.isdir(fullpath): | ||
media_dirs.append(fullpath) | ||
|
||
for media_dir in media_dirs: | ||
|
||
print '\nChecking %s...' % media_dir | ||
|
||
fakepath = '%s_%s_%s' % (media_dir, my_ip, my_name) | ||
print '...fakepath: %s' % fakepath | ||
|
||
db = os.path.join(media_dir, 'msmMMOB.mdb') | ||
print '...Checking for %s' % db | ||
if os.path.exists(db): | ||
print '......found %s.' % db | ||
db_mtime = os.stat(db)[stat.ST_MTIME] | ||
newer_file = False | ||
for child in os.listdir(media_dir): | ||
if child == 'msmMMOB.mdb' or child == 'msmFMID.pmr': | ||
continue | ||
child_mtime = os.stat(os.path.join(media_dir, child))[stat.ST_MTIME] | ||
if child_mtime > db_mtime: | ||
print '......found newer file %s' % child | ||
newer_file = True | ||
break | ||
else: | ||
print '......no %s.' % db | ||
newer_file = True | ||
|
||
if newer_file: | ||
utime = None # Sets to current time. | ||
print '...Setting fake mtime to NOW. Will trigger re-index.' | ||
else: | ||
mtime = os.stat(media_dir)[stat.ST_MTIME] | ||
utime = (mtime, mtime) | ||
print '...Setting fake mtime to media_dir mtime. No re-index.' | ||
|
||
if not os.path.exists(fakepath): | ||
tmp_fakepath = '%s.tmp' % fakepath | ||
open(tmp_fakepath, 'a').close() | ||
os.utime(tmp_fakepath, utime) | ||
os.rename(tmp_fakepath, fakepath) | ||
else: | ||
os.utime(fakepath, utime) | ||
|
||
dummy = raw_input("\nPress Enter to finish: ") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.