Menu

#17 Minor change to allow previewing

open
nobody
None
5
2003-06-15
2003-06-15
Anonymous
No

It was getting annoying that you can't preview files in
mutella. The only reason is that the partial filenames
don't have the correct extensions. The standard partial
filename format is:
<filename>.[[<filesize>]]
This patch changes this format to
[[<filesize>]].<filename>
which means that the extension is preserved and I can
preview the files before they have downloaded.
The downside is that, after applying the patch, you will
lose all your current partial file download _unless_ you
rename the files yourself, to the new format.
Any questions? mail davehind@yahoo.co.uk
To apply
1. unzip the two files (controller.cpp and
gnudirector.cpp) to mutella 0.4.3 source dir.
2. make clean
3. make
4. make install
Cheers,
Dave.

Discussion

  • Nobody/Anonymous

    Logged In: NO

    Hmmm. The attachment didn't work so here are the patches:

    --- controller.cpp.orig Mon Jan 20 12:55:51 2003
    +++ controller.cpp Sun Jun 15 02:45:24 2003
    @@ -369,11 +369,11 @@
    {
    CString path = partials[i].Path;
    CString name = partials[i].Name;
    - int nB1 = name.find(".[[");
    - int nB2 = name.find("]]");
    - int nSize = atoi(name.substr(nB1+3, nB2-
    (nB1+3)).c_str());
    + int nB1 = name.find("[[");
    + int nB2 = name.find("]].");
    + int nSize = atoi(name.substr(nB1+2, nB2-
    (nB1+2)).c_str());
    //
    - name = name.substr(0,nB1);
    + name = name.substr(nB2+3,name.length()-
    (nB2+3));

    // repair stuck downloads
    if (nSize <= partials[i].Size)

    --- gnudirector.cpp.orig Tue Jan 28 18:11:59 2003
    +++ gnudirector.cpp Sun Jun 15 03:01:10 2003
    @@ -1285,7 +1285,7 @@
    // Add tail to it so we can support partial downloads
    if (psPartPath)
    {
    - sFileName += ".[[" + DWrdtoStr(nFileSize)
    + "]]";
    + sFileName = "[[" + DWrdtoStr(nFileSize)
    + "]]." + sFileName;
    // put the file to the partial directory
    *psPartPath = ExpandPath(m_pPrefs-
    >m_szDownloadPath) + "/part" + "/" + sFileName;
    ReplaceSubStr(*psPartPath, "//", "/");

     
  • Nobody/Anonymous

    Logged In: NO

    Ohdear. Apologies. I've made a stupid error. Here's a
    _working_ patch.

    --- controller.cpp.orig Mon Jan 20 12:55:51 2003
    +++ controller.cpp Sun Jun 15 12:54:03 2003
    @@ -356,7 +356,7 @@
    void MController::LoadPartials(const CString& partDir)
    {
    DirEntryVec partials;
    - if (!ScanDir(partials, ExpandPath(partDir), "*.[[*]]"))
    + if (!ScanDir(partials, ExpandPath(partDir), "[[*]].*"))
    {
    POST_ERROR(ES_IMPORTANT, CString("LoadPartials:
    error scanning the dir `") + partDir + "'");
    return;
    @@ -369,11 +369,11 @@
    {
    CString path = partials[i].Path;
    CString name = partials[i].Name;
    - int nB1 = name.find(".[[");
    - int nB2 = name.find("]]");
    - int nSize = atoi(name.substr(nB1+3, nB2-
    (nB1+3)).c_str());
    - //
    - name = name.substr(0,nB1);
    + int nB1 = name.find("[[");
    + int nB2 = name.find("]].");
    + int nSize = atoi(name.substr(nB1+2, nB2-
    (nB1+2)).c_str());
    + //
    + name = name.substr(nB2+3,name.length()-
    (nB2+3));

    // repair stuck downloads
    if (nSize <= partials[i].Size)

    --- gnudirector.cpp.orig Tue Jan 28 18:11:59 2003
    +++ gnudirector.cpp Sun Jun 15 03:01:10 2003
    @@ -1285,7 +1285,7 @@
    // Add tail to it so we can support partial downloads
    if (psPartPath)
    {
    - sFileName += ".[[" + DWrdtoStr(nFileSize)
    + "]]";
    + sFileName = "[[" + DWrdtoStr(nFileSize)
    + "]]." + sFileName;
    // put the file to the partial directory
    *psPartPath = ExpandPath(m_pPrefs-
    >m_szDownloadPath) + "/part" + "/"
    + sFileName;
    ReplaceSubStr(*psPartPath, "//", "/");

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.