Ticket #248: mythvideo-dvd-copy-feature.patch

File mythvideo-dvd-copy-feature.patch, 3.0 KB (added by erik@…, 19 years ago)

add dvd copy playing to mythvideo

  • mythvideo/metadata.cpp

     
    11#include <qfile.h>
     2#include <qdir.h>
     3#include <qfileinfo.h>
    24#include <cmath>
    35#include <iostream>
    46#include <mythtv/mythdbcon.h>
     
    7678    }
    7779}
    7880
     81bool Metadata::removeDir(QString& dirName)
     82{
     83    QDir d(dirName);
     84
     85    const QFileInfoList *contents = d.entryInfoList();
     86    if (!contents)
     87    {
     88        return d.rmdir(dirName);
     89    }
     90
     91    const QFileInfoListIterator it(*contents);
     92    QFileInfo *fi;
     93
     94    while ((fi = it.current()) != 0)
     95    {
     96        if (fi->fileName() == "." ||
     97            fi->fileName() == "..")
     98        {
     99            continue;
     100        }
     101        if (fi->isDir())
     102        {
     103            QString fileName = fi->fileName();
     104            if (!removeDir(fileName))
     105                return false;
     106        }
     107        else
     108        {
     109            if (!QFile(fi->fileName()).remove())
     110                return false;
     111        }
     112    }
     113    return d.rmdir(dirName);
     114}
     115
    79116bool Metadata::Remove()
    80117{
    81     QFile videofile;
    82     videofile.setName(filename);
    83     bool isremoved = videofile.remove();
     118    bool isremoved = false;
     119    QFileInfo fi(filename);
     120    if (fi.isDir())
     121    {
     122        isremoved = removeDir(filename);
     123    }
     124    else
     125    {
     126        QFile videofile;
     127        videofile.setName(filename);
     128        isremoved = videofile.remove();
     129    }
    84130    if (isremoved)
    85131    {
    86132        MSqlQuery query(MSqlQuery::InitCon());
  • mythvideo/dbcheck.cpp

     
    9696"    VALUES (\"vob\", \"\", 0, 1);",
    9797"INSERT INTO videotypes (extension, playcommand, f_ignore, use_default)"
    9898"    VALUES (\"mpeg\", \"\", 0, 1);",
     99"INSERT INTO videotypes (extension, playcommand, f_ignore, use_default)"
     100"    VALUES (\"VIDEO_TS\", \"mplayer -fs -zoom -quiet -vo xv -dvd-device %s dvd://1\", 0, 1);",
    99101""
    100102};
    101103        dbver = "";
  • mythvideo/videoscan.cpp

     
    191191       
    192192        QString filename = fi->absFilePath();
    193193        if (fi->isDir())
    194             buildFileList(filename, imageExtensions);
     194        {
     195            if (fi->fileName() == QString("VIDEO_TS") ||
     196                fi->fileName() == QString("video_ts"))
     197            {
     198                filename = fi->dirPath(true);
     199                if (!filename.isEmpty())
     200                    m_VideoFiles[filename] = kFileSystem;
     201            }
     202            else
     203                buildFileList(filename, imageExtensions);
     204        }
    195205        else
    196206        {
    197207            r.setPattern("^" + fi->extension() + "$");
  • mythvideo/metadata.h

     
    181181    void updateCountries();
    182182    void fillGenres();
    183183    void updateGenres();
     184    bool removeDir(QString& dirName);
    184185    QImage* coverImage;
    185186    QPixmap* coverPixmap;
    186187