"Plugin" is a bit evasive. it's an agent which follows a specifically defined framework [dev.plexapp.com/docs/api/datakit.html] or a scanner which can't use theses functions. If you manage a metadata agent, it's in the wrong category (scanner)
Agents can't write to the video files folder but can read it. Agents can however write to the agent data folder but not create new folders, need to be done manually. Hama agent write to the agent data folder for xml and picture cache. Check Hama source code for Data.load like:
error_log['log_file']=["log1", "log 2", log 3]
### HAMA - Load logs, add non-present entried then Write log files to Plug-in /Support/Data/com.plexapp.agents.hama/DataItems ###
for log in error_log:
if error_log[log] != []:
if not Data.Exists(log+".htm"):
string=""
else: string = Data.Load(log+".htm")
for entry in error_log[log]:
if entry not in string: Data.Save(log+".htm", string + entry + "
")
Scanners generally don't write files. My "Absolute series scanner" is the only one i saw to do such thing. It can write to the hdd using:
### Log function ########################################################################################
def Log(entry, filename='Plex Media Scanner Custom.log'): #need relative path
#Logging = [ ['Synology', "/volume1/Plex/Library/Application Support/Plex Media Server/Logs/"],
# ['Synology2', "../../Plex/Library/Application Support/Plex Media Server/Logs/"],
# ['Ubuntu-10.04', "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Logs/"]
# ['windows Vista/7/8', "C:\\Users\\Default\\AppData\\Local\\Plex Media Server\\Logs\\"],
# ['Qnap', ""]
# ]
try:
with open(filename, 'a') as file: #with open("/volume1/Plex/Library/Application Support/Plex Media Server/Logs/" + filename, 'a') as file:
file.write( entry + "
" ) #
make it readable in notepad under windows directly
print line + "
"
except: pass
You call it like: Log("Scan: (root: '%s', path='%s', subdirs: %s, language: '%s')" % (root, path, str(subdirs), language)) from scanner side