~ubuntu-branches/ubuntu/utopic/smplayer/utopic

« back to all changes in this revision

Viewing changes to src/findsubtitles/osparser.cpp

  • Committer: Package Import Robot
  • Author(s): Maia Kozheva, Maia Kozheva, Alessio Treglia
  • Date: 2012-04-14 12:01:57 UTC
  • mfrom: (20.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20120414120157-7yx90enjufwsc3fd
Tags: 0.8.0-1
[ Maia Kozheva ]
* New upstream release:
  - Changes since 0.7.1:
    + A toolbar editor has been added. Now it's possible to select the
      buttons and controls that want to appear in the toolbars.
    + New video filters: gradfun, blur and sharpen.
    + Now it's possible to change the GUI (default, mini, mpc) at runtime,
      no restart required.
    + sub files from opensubtitles should work again.
    + (Youtube) Recognize short urls (like this one:
      http://y2u.be/F5OcZBVPwOA)
    + Better support for chapters in video files.
    + Bug fix: remote m3u files work from the favorites menu or command line.
    + Internal changes in the single instance option (switch to 
      QtSingleApplication).
  - Fixes since 0.7.0:
    + SMPlayer took more than 10 seconds to show when running for the very
      first time.
    + The links to download subtitles from Opensubtitles were wrong.
    + SMPlayer crashed in the favorite editor when trying to select a file
      if the KDE open dialog was used.
  - Changes since 0.7.0:
    + By default the screenshots are saved in the user's pictures folder
      instead of the SMPlayer's config folder.
    + Now it's possible to change the opensubtitles server.
    + Youtube: seeking is slow with flv videos, so now flv videos have the
      lowest priority.
    + Youtube: now it's possible to search and download videos from youtube.
      This is provided by an external application (in linux you have to
      install an independent package: smtube).
* debian/copyright:
  - Rewrite according to DEP-5 specification.
* debian/control:
  - Depend on mplayer2 | mplayer. (Closes: #638279)
  - Update Standards-Version to 3.9.3.
* Remove debian/patches/handle_local_urls.diff, merged upstream.

[ Alessio Treglia ]
* Mention smplayer is also a front-end for MPlayer2.
* Fix small typo in the description.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
#include "osparser.h"
20
20
#include <QDomDocument>
21
 
#include <QFile>
22
 
#include <QDataStream>
 
21
//#include <QFile>
 
22
//#include <QDataStream>
23
23
 
24
24
OSParser::OSParser() {
25
25
}
54
54
                        OSSubtitle sub;
55
55
 
56
56
                        sub.releasename = subtitle.firstChildElement("releasename").text();
57
 
                        sub.link = base_url + subtitle.firstChildElement("download").text();
 
57
                        QString path = subtitle.firstChildElement("download").text();
 
58
                        if (path.contains("http://")) {
 
59
                                sub.link = subtitle.firstChildElement("download").text();
 
60
                        } else {
 
61
                                sub.link = base_url + subtitle.firstChildElement("download").text();
 
62
                        }
58
63
                        sub.detail = subtitle.firstChildElement("detail").text();
59
64
                        sub.date = subtitle.firstChildElement("subadddate").text();
60
65
                        sub.rating = subtitle.firstChildElement("subrating").text();
75
80
        return true;
76
81
}
77
82
 
78
 
// From the patch by Kamil Dziobek turbos11(at)gmail.com
79
 
// (c) Kamil Dziobek turbos11(at)gmail.com | BSD or GPL or public domain
80
 
QString OSParser::calculateHash(QString filename) {
81
 
        QFile file(filename);
82
 
 
83
 
        if (!file.exists()) {
84
 
                qWarning("OSParser:calculateHash: error hashing file. File doesn't exist.");
85
 
                return QString();
86
 
        }
87
 
 
88
 
        file.open(QIODevice::ReadOnly);
89
 
        QDataStream in(&file);
90
 
        in.setByteOrder(QDataStream::LittleEndian);
91
 
        quint64 size=file.size ();
92
 
        quint64 hash=size; 
93
 
        quint64 a;
94
 
        for(int i = 0; i < 8192; i++) {
95
 
                in >> a ; hash += a;
96
 
        };
97
 
        file.seek(size-65536);
98
 
        for(int i = 0; i < 8192; i++) {
99
 
                in >> a ; hash += a;
100
 
        };
101
 
 
102
 
        QString hexhash = QString("%1").arg(hash, 16, 16, QChar('0'));
103
 
 
104
 
        return hexhash;
105
 
}
106