Welcome to the Invelos forums. Please read the forum rules before posting.

Read access to our public forums is open to everyone. To post messages, a free registration is required.

If you have an Invelos account, sign in to post.

    Invelos Forums->DVD Profiler: Plugins Page: 1  Previous   Next
Watched Stats for DVD Profiler Collection
Author Message
DVD Profiler Unlimited Registrantgoodguy
Sita Sings the Blues
Registered: March 14, 2007
Reputation: Superior Rating
Germany Posts: 1,029
Posted:
PM this userDirect link to this postReply with quote
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>&#160;</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])
            &gt;= $pMin and
          count(Events/Event[EventType='Watched' and
                User/@FirstName=$pUserFN and
                User/@LastName=$pUserLN])
            &lt;=$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
    DVD Profiler Desktop and Mobile RegistranttheFRAGGLE
    Registered: October 8, 2007
    Switzerland Posts: 55
    Posted:
    PM this userVisit this user's homepageView this user's DVD collectionDirect link to this postReply with quote
    Nice! Thanks. Great for fooling around with the data... :-)
    DVD Profiler Desktop and Mobile Registrantmediadogg
    Aim high. Ride the wind.
    Registered: March 18, 2007
    Reputation: Highest Rating
    United States Posts: 6,402
    Posted:
    PM this userVisit this user's homepageDirect link to this postReply with quote
    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
    DVD Profiler Unlimited RegistrantEdwinK
    Registered: May 27, 2007
    Netherlands Posts: 691
    Posted:
    PM this userEmail this userView this user's DVD collectionDirect link to this postReply with quote
    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.
    DVD Profiler Unlimited RegistrantStar Contributorkosvines
    Registered: March 19, 2007
    Norway Posts: 581
    Posted:
    PM this userView this user's DVD collectionDirect link to this postReply with 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.
    DVD Profiler Unlimited Registrantgoodguy
    Sita Sings the Blues
    Registered: March 14, 2007
    Reputation: Superior Rating
    Germany Posts: 1,029
    Posted:
    PM this userDirect link to this postReply with quote
    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
    DVD Profiler Unlimited RegistrantStar Contributorsurfeur51
    Since July 3, 2003
    Registered: March 29, 2007
    Reputation: Great Rating
    France Posts: 4,479
    Posted:
    PM this userView this user's DVD collectionDirect link to this postReply with quote
    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
    DVD Profiler Unlimited RegistrantStar ContributorMithi
    Sushi Annihilator
    Registered: March 13, 2007
    Reputation: Superior Rating
    Germany Posts: 2,216
    Posted:
    PM this userEmail this userVisit this user's homepageView this user's DVD collectionDirect link to this postReply with quote
    User: Mithi  # Profiles  % of Owned
    Owned            763        100%
    Unwatched        39        5%
    Watched Once  688        90%
    Watched Twice    30        4%
    Watched 3+        6        1%
    Mithi's little XSLT tinkering - the power of XML --- DVD-Profiler Mini-Wiki
    DVD Profiler Unlimited RegistrantStar ContributorDedcap
    Registered: March 14, 2007
    France Posts: 159
    Posted:
    PM this userDirect link to this postReply with quote
    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?
    DVD Profiler Unlimited RegistrantStar Contributorreybr
    Registered: March 13, 2007
    Reputation: High Rating
    Norway Posts: 906
    Posted:
    PM this userView this user's DVD collectionDirect link to this postReply with quote
    # 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
    DVD Profiler Unlimited RegistrantFrodonf
    Registered: March 14, 2007
    Canada Posts: 225
    Posted:
    PM this userView this user's DVD collectionDirect link to this postReply with quote
    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
    DVD Profiler Desktop and Mobile RegistrantStar ContributorStaid S Barr
    Registered: Oct 16, 2003
    Registered: May 9, 2007
    Netherlands Posts: 1,536
    Posted:
    PM this userDirect link to this postReply with quote
    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
    DVD Profiler Desktop and Mobile RegistrantStar Contributordavidwinney
    Registered: March 19, 2007
    United Kingdom Posts: 14
    Posted:
    PM this userView this user's DVD collectionDirect link to this postReply with quote
    # 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. 
        Invelos Forums->DVD Profiler: Plugins Page: 1  Previous   Next