I also needed my videos (self recorded) to be sorted by year. As the feature request is quite old I am now using the following workaround. Maybe this helps other users as well:
For each *mov,*avi,*mkv file I created an AHK script that will create an XBMC nfo file like this:
- Code:
<movie>
<title>MVI_4053[nfo]</title>
<director>1 2011 06</director>
</movie>
Now I can browse my files per year/month by "reusing" the Directors category.
Example:
Video
-Directors
--1 (all years 1991,2001,2011,...)
---1 2011 01 (all movies Jan 2011)
----MVI_2344[nfo]
----MVI_2345[nfo]
----... all other movies created in jan 2011
---2 2011 02 (all movies Feb 2011)
--2 (all years 1992,2002,2012,...)
--3 (all years 1993,2003,2013,...)
...
If somebody wants to try. Below is the ahk script. You have to install autohotkey from
http://www.autohotkey.com/ to run the script.
Upon start script will ask you to select a folder. Once folder is selected it will scan all files in this folder and subfolders of the selected folder. If it finds a file with extension mkv,avi,mov and there is no corresponding nfo file if will create one.
- Code:
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn ; Recommended for catching common errors.
#SingleInstance force
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
GetFilename(filepath)
{
; filepath C:\Users\user\Documents\ahk\MVI_4053.MOV should return MVI_4053.MOV
SplitPath, filepath, outFileName
return outFileName
}
GetFilenameWithoutExtension(filepath)
{
; filepath C:\Users\user\Documents\ahk\MVI_4053.MOV should return MVI_4053
SplitPath, filepath,,,,OutNameNoExt
return OutNameNoExt
}
GetNfoFileName(filepath)
{
; filepath C:\Users\user\Documents\ahk\MVI_4053.MOV should return C:\Users\user\Documents\ahk\MVI_4053.nfo
SplitPath, filepath , OutFileName, OutDir, OutExtension, OutNameNoExt, OutDrive
return OutDir . "\" . OutNameNoExt . ".nfo"
}
GetTimeLabel(filepath)
{
; filepath C:\Users\user\Documents\ahk\MVI_4053.MOV should return "1 2011 06" (modification time 2011.06.24)
FileGetTime, timeLabel , %filepath%, M
FormatTime, year , %timeLabel%, yyyy
FormatTime, month , %timeLabel%, MM
index := mod(year,10)
return index . " " . year . " " . month
}
Output(text)
{
GuiControl,, MyListBox, %text%
Gui, Show, AutoSize Center
}
GenerateNfoForFile(filepath)
{
nfoFileName := GetNfoFileName(filepath)
IfExist, %nfoFileName%
{
Output("Skipped: " . filepath . ". nfo File already exists.")
return
}
;Output("<movie>")
text := "<movie>`n"
FileAppend , %text%, %nfoFileName%, UTF-16
;Output("<title>MVI_4053.MOV</title>")
text := "<title>" . GetFilenameWithoutExtension(filepath) . "[nfo]</title>`n"
FileAppend , %text%, %nfoFileName%
;Output("<director>1 2011 06</director>")
text := "<director>" . GetTimeLabel(filepath) . "</director>`n"
FileAppend , %text%, %nfoFileName%
;Output("</movie>")
text := "</movie>`n"
FileAppend , %text%, %nfoFileName%
Output("Created: " . nfoFileName)
}
Gui, Add, Text,, Simple Output Window.
Gui, Add, ListBox, vMyListBox gMyListBox w640 r20
Gui, Add, Button, Default, OK
FileSelectFolder, folder2scan, , 0 , Select folder to scan for video files
if folder2scan =
{
MsgBox, You didn't select a folder. I will exit now.
ExitApp
}
Output("Selected folder: " . folder2scan)
Loop, %folder2scan%\*, 1, 1
{
if A_LoopFileAttrib contains D ; Skip directories
continue
if A_LoopFileExt in mkv,avi,mov
{
GenerateNfoForFile(A_LoopFileLongPath)
}
}
return
MyListBox:
return
ButtonOK:
GuiClose:
GuiEscape:
ExitApp