Browse Source

Improve torrent name handling

adaptive-webui-19844
Vladimir Golovnev (Glassez) 4 years ago
parent
commit
77555cd5c2
No known key found for this signature in database
GPG Key ID: 52A2C7DEE2DFA6F7
  1. 4
      src/base/bittorrent/session.cpp
  2. 16
      src/base/bittorrent/torrenthandleimpl.cpp
  3. 2
      src/base/bittorrent/torrentinfo.cpp

4
src/base/bittorrent/session.cpp

@ -661,9 +661,7 @@ QString Session::tempPath() const @@ -661,9 +661,7 @@ QString Session::tempPath() const
QString Session::torrentTempPath(const TorrentInfo &torrentInfo) const
{
if ((torrentInfo.filesCount() > 1) && !torrentInfo.hasRootFolder())
return tempPath()
+ QString::fromStdString(torrentInfo.nativeInfo()->orig_files().name())
+ '/';
return tempPath() + torrentInfo.name() + '/';
return tempPath();
}

16
src/base/bittorrent/torrenthandleimpl.cpp

@ -185,17 +185,15 @@ InfoHash TorrentHandleImpl::hash() const @@ -185,17 +185,15 @@ InfoHash TorrentHandleImpl::hash() const
QString TorrentHandleImpl::name() const
{
QString name = m_name;
if (!name.isEmpty()) return name;
name = QString::fromStdString(m_nativeStatus.name);
if (!name.isEmpty()) return name;
if (!m_name.isEmpty())
return m_name;
if (hasMetadata())
{
name = QString::fromStdString(m_torrentInfo.nativeInfo()->orig_files().name());
if (!name.isEmpty()) return name;
}
return m_torrentInfo.name();
const QString name = QString::fromStdString(m_nativeStatus.name);
if (!name.isEmpty())
return name;
return m_hash;
}

2
src/base/bittorrent/torrentinfo.cpp

@ -170,7 +170,7 @@ InfoHash TorrentInfo::hash() const @@ -170,7 +170,7 @@ InfoHash TorrentInfo::hash() const
QString TorrentInfo::name() const
{
if (!isValid()) return {};
return QString::fromStdString(m_nativeInfo->name());
return QString::fromStdString(m_nativeInfo->orig_files().name());
}
QDateTime TorrentInfo::creationDate() const

Loading…
Cancel
Save