Author |
Message |
Registered: March 14, 2007 | Reputation: | Posts: 1,029 |
| Posted: | | | | Please note that this is not a plugin; it is more like an external tool. But since the General Forum is a bit of a garbage dump and the Layouts Forum isn't appropriate either, I decided to post it here. Also, I might someday turn this into a plugin to support custom XPath queries and XSL transformations against the DVD Profiler database without the hazzle of exporting to XML. Based on a question from a user on another forum for DVD collectors, I created the following little XSLT script that analyzes your watched history and groups the profiles by the number of times you have watched them. In order to use it, you must have recorded a Watched event in DVD Profiler, each time you have watched a DVD. The script supports multiple users and displays the results separately for each user. The results are strictly profile-based. If you have made heavy use of boxsets and child profiles, the results might be a little off. Sample results: Quote: User: Myself
Owned Unwatched Watched Once Watched Twice Watched 3+
# Profiles 416 7 138 162 109 % of Owned 100% 2% 33% 39% 26% Please note that this is just a quick-shot. You have to do a little work yourself in order to get it working. Save the code below in a file named WatchedStats.xslt.Export your DVD Profiler collection into an XML file. You can omit cast, crew and all other extra stuff to keep the file smaller.Open the XML file with a text editor and insert a <?xml-stylesheet> instruction referring WatchedStats.xslt right before the <Collection> root tag.Open the modified XML file with IE.Have fun and don't forget to post your results. File WatchedStats.xslt: Quote:
<?xml version="1.0" encoding="UTF-8"?> <!-- Copyright (c) 2009 Matthias Wolf, Germany AKA goodguy --> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:key name="keyUser" match="/Collection/DVD[CollectionType='Owned']/Events/Event[EventType='Watched']/User" use="concat(@FirstName, '|', @LastName)" />
<xsl:param name="gTotalCount" select="count(/Collection/DVD[CollectionType='Owned'])"/>
<xsl:template match="/"> <html> <head> <title>Watched Stats</title> </head> <body> <h1>Watched Statistics</h1> <p><b>Copyright (c) 2009 Matthias Wolf, Germany AKA goodguy</b></p> <p>Please note: These stats are strictly profile-based. If you have made heavy use of boxsets and child profiles, results may be off.</p> <xsl:apply-templates select="/Collection/DVD[CollectionType='Owned']/Events/Event[EventType='Watched']/User" /> </body> </html> </xsl:template>
<xsl:template match="User"> <xsl:if test="generate-id() = generate-id(key('keyUser', concat(@FirstName, '|', @LastName))[1])"> <h2><xsl:value-of select="concat('User: ', @FirstName, ' ', @LastName)"/></h2> <table border="1" cellpadding="5"> <colgroup><col align="left" /><col align="right" /><col align="right" /></colgroup> <tr> <th> </th> <th># Profiles</th> <th>% of Owned</th> </tr> <tr> <td>Owned</td> <td><xsl:value-of select="$gTotalCount" /></td> <td>100%</td> </tr> <xsl:call-template name="doCount"> <xsl:with-param name="pUserFN" select="@FirstName"/> <xsl:with-param name="pUserLN" select="@LastName"/> <xsl:with-param name="pDisplay" select="'Unwatched'"/> <xsl:with-param name="pMin" select="0"/> <xsl:with-param name="pMax" select="0"/> </xsl:call-template> <xsl:call-template name="doCount"> <xsl:with-param name="pUserFN" select="@FirstName"/> <xsl:with-param name="pUserLN" select="@LastName"/> <xsl:with-param name="pDisplay" select="'Watched Once'"/> <xsl:with-param name="pMin" select="1"/> <xsl:with-param name="pMax" select="1"/> </xsl:call-template> <xsl:call-template name="doCount"> <xsl:with-param name="pUserFN" select="@FirstName"/> <xsl:with-param name="pUserLN" select="@LastName"/> <xsl:with-param name="pDisplay" select="'Watched Twice'"/> <xsl:with-param name="pMin" select="2"/> <xsl:with-param name="pMax" select="2"/> </xsl:call-template> <xsl:call-template name="doCount"> <xsl:with-param name="pUserFN" select="@FirstName"/> <xsl:with-param name="pUserLN" select="@LastName"/> <xsl:with-param name="pDisplay" select="'Watched 3+'"/> <xsl:with-param name="pMin" select="3"/> <xsl:with-param name="pMax" select="999999"/> </xsl:call-template> </table> </xsl:if> </xsl:template>
<xsl:template name="doCount"> <xsl:param name="pUserFN"/> <xsl:param name="pUserLN"/> <xsl:param name="pDisplay"/> <xsl:param name="pMin"/> <xsl:param name="pMax"/>
<xsl:variable name="n" select=" count(/Collection/DVD[CollectionType='Owned' and count(Events/Event[EventType='Watched' and User/@FirstName=$pUserFN and User/@LastName=$pUserLN]) >= $pMin and count(Events/Event[EventType='Watched' and User/@FirstName=$pUserFN and User/@LastName=$pUserLN]) <=$pMax]) "/> <tr> <td><xsl:value-of select="$pDisplay" /></td> <td><xsl:value-of select="$n" /></td> <td><xsl:value-of select="round($n div $gTotalCount * 100)" />%</td> </tr> </xsl:template>
</xsl:stylesheet>
Insert this line into the exported XML collection file, right before the <Collection> tag. Replace the sample path with your real file path: Quote:
<?xml-stylesheet type="text/xsl" href="C:\Sample\WatchedStats.xslt"?>
Open the modified XML file with IE. | | | Matthias |
|
Registered: October 8, 2007 | Posts: 55 |
| Posted: | | | | Nice! Thanks. Great for fooling around with the data... :-) | | | |
|
Registered: March 18, 2007 | Reputation: | Posts: 6,461 |
| Posted: | | | | Yeah, I would love such a plugin. Some thoughts: - ability to set flags based on the query. My selfish motive: as a front-end to BulkEdit and QuikEdit (in the works) - ability to write files: My selfish motive: Faster, easier alternative to DVDProfileLoop Now for icing on the cake, if you could make a callable dll fast search engine API, input = xpath or xsl script , output = list of profile ids, other plugin developers could take advantage of your efforts (of course we may not need it, if Ken is adding the things we asked for in the new toolkit). | | | Thanks for your support. Free Plugins available here. Advanced plugins available here. Hey, new product!!! BDPFrog. | | | Last edited: by mediadogg |
|
Registered: May 27, 2007 | Posts: 691 |
| Posted: | | | | Would like to see this as a plugin. Pretty please | | | Unfortunately, I can't use DVDprofiler at the moment due to lack of a Windows computer. |
|
Registered: March 19, 2007 | Posts: 582 |
| Posted: | | | | Couldn't get it to work though. When opening, Internet Explorer just open it in Macromedia Dreamweaver instead, and using the IE plugin in Firefox just gives me an error saying it can't show a XML page with XLS. | | | |
|
Registered: March 14, 2007 | Reputation: | Posts: 1,029 |
| Posted: | | | | Quoting Beastus: Quote: Couldn't get it to work though. When opening, Internet Explorer just open it in Macromedia Dreamweaver instead, and using the IE plugin in Firefox just gives me an error saying it can't show a XML page with XLS. That is a bug in DreamWeaver. The DreamWeaver installation changes the content type of XML files from "text/xml" to " application/x-xml". That causes IE to use the external application. The content type can be found in the Windows registry under HKEY_CLASSES_ROOT\.xml. AFAIK, DreamWeaver already has provided a fix for this a while ago, you should check their website. Alternatively, you can change the content type in the registry back to the proper "text/xml". | | | Matthias |
|
Registered: March 29, 2007 | Reputation: | Posts: 4,479 |
| Posted: | | | | Works fine. Thank you very much Results for myself: Owned 943 100% Unwatched 2 0% Watched Once 772 82% Watched Twice 145 15% Watched 3+ 24 3% | | | Images from movies |
|
Registered: March 13, 2007 | Reputation: | Posts: 2,217 |
| |
Registered: March 14, 2007 | Posts: 159 |
| Posted: | | | | It works nice
Can you think you can add something about rent and loan? For example, when I lend a DVD to a friend, I didn't put it like he sees it but like he borrows it, do you see my point? |
|
Registered: March 13, 2007 | Reputation: | Posts: 906 |
| Posted: | | | | # Profiles % of Owned Owned 1171 100% Unwatched 276 24% Watched Once 885 76% Watched Twice 9 1% Watched 3+ 1 0% | | | The colour of her eyes, were the colour of insanity | | | Last edited: by reybr |
|
Registered: March 14, 2007 | Posts: 225 |
| Posted: | | | | Thanks goodguy! # Profiles % of Owned Owned 821 100% Unwatched 436 53% Watched Once 353 43% Watched Twice 11 1% Watched 3+ 21 3% Hmm... I think I should stop buying and start watching... | | | Certainty of death... Small chance of success... What are we waiting for ?! | | | Last edited: by Frodonf |
|
Registered: May 9, 2007 | Posts: 1,536 |
| Posted: | | | | Lots of work/watching to be done! I spent too much time on profiling... # Profiles % of Owned Owned 1717 100% Unwatched 714 42% Watched Once 936 55% Watched Twice 50 3% Watched 3+ 17 1% | | | Hans |
|
Registered: March 19, 2007 | Posts: 14 |
| Posted: | | | | # Profiles % of Owned Owned 3357 100% Unwatched 1766 53% Watched Once 1554 46% Watched Twice 34 1% Watched 3+ 3 0% Guess I should be spending more time catching up on the pile of DVD and less doing other things. |
|