Exemplo n.º 1
0
bool Folder::init()
{
    QString url = Utility::toCSyncScheme(ownCloudInfo::instance()->webdavUrl() + secondPath());
    QString localpath = path();

    if( csync_create( &_csync_ctx, localpath.toUtf8().data(), url.toUtf8().data() ) < 0 ) {
        qDebug() << "Unable to create csync-context!";
        slotCSyncError(tr("Unable to create csync-context"));
        _csync_ctx = 0;
    } else {
        csync_set_log_callback(   _csync_ctx, csyncLogCatcher );
        csync_set_log_verbosity(_csync_ctx, 11);

        MirallConfigFile cfgFile;
        csync_set_config_dir( _csync_ctx, cfgFile.configPath().toUtf8() );

        csync_enable_conflictcopys(_csync_ctx);
        setIgnoredFiles();
        cfgFile.getCredentials()->syncContextPreInit(_csync_ctx);

        if( csync_init( _csync_ctx ) < 0 ) {
            qDebug() << "Could not initialize csync!" << csync_get_error(_csync_ctx) << csync_get_error_string(_csync_ctx);
            slotCSyncError(CSyncThread::csyncErrorToString(csync_get_error(_csync_ctx), csync_get_error_string(_csync_ctx)));
            csync_destroy(_csync_ctx);
            _csync_ctx = 0;
        }
    }
    return _csync_ctx;
}
Exemplo n.º 2
0
bool ownCloudFolder::init()
{
    QString url = replaceScheme(ownCloudInfo::instance()->webdavUrl() + secondPath());
    QString localpath = path();

    if( csync_create( &_csync_ctx, localpath.toUtf8().data(), url.toUtf8().data() ) < 0 ) {
        qDebug() << "Unable to create csync-context!";
        slotCSyncError(tr("Unable to create csync-context"));
        _csync_ctx = 0;
    } else {
        csync_set_log_callback(   _csync_ctx, csyncLogCatcher );
        csync_set_log_verbosity(_csync_ctx, 11);

        MirallConfigFile cfgFile;
        csync_set_config_dir( _csync_ctx, cfgFile.configPath().toUtf8() );

        csync_enable_conflictcopys(_csync_ctx);
        QString excludeList = cfgFile.excludeFile();
        if( !excludeList.isEmpty() ) {
            qDebug() << "==== added CSync exclude List: " << excludeList.toUtf8();
            csync_add_exclude_list( _csync_ctx, excludeList.toUtf8() );
        }
        csync_set_auth_callback( _csync_ctx, getauth );

        if( csync_init( _csync_ctx ) < 0 ) {
            qDebug() << "Could not initialize csync!" << csync_get_error(_csync_ctx) << csync_get_error_string(_csync_ctx);
            slotCSyncError(CSyncThread::csyncErrorToString(csync_get_error(_csync_ctx), csync_get_error_string(_csync_ctx)));
            csync_destroy(_csync_ctx);
            _csync_ctx = 0;
        }
        setProxy();
    }
    return _csync_ctx;
}
Exemplo n.º 3
0
QString ownCloudFolder::nativeSecondPath() const
{
    // TODO: fold into secondPath() after 1.1.0 release
    QString path = secondPath();
    if (!path.startsWith(QLatin1Char('/')) || path.isEmpty())
        path.prepend(QLatin1Char('/'));
    return path;
}
Exemplo n.º 4
0
void Folder::slotPollTimerTimeout()
{
    qDebug() << "* Polling" << alias() << "for changes. Ignoring all pending events until now";
    _watcher->clearPendingEvents();

    QObject::connect(new RequestEtagJob(secondPath(), this), SIGNAL(etagRetreived(QString)),
                     this, SLOT(etagRetreived(QString)));
}
Exemplo n.º 5
0
void Folder::slotPollTimerTimeout()
{
    qDebug() << "* Polling" << alias() << "for changes. (time since next sync:" << (_timeSinceLastSync.elapsed() / 1000) << "s)";

    if (quint64(_timeSinceLastSync.elapsed()) > MirallConfigFile().forceSyncInterval()) {
        qDebug() << "* Force Sync now";
        evaluateSync(QStringList());
    } else {
        RequestEtagJob* job = new RequestEtagJob(secondPath(), this);
        // check if the etag is different
        QObject::connect(job, SIGNAL(etagRetreived(QString)), this, SLOT(etagRetreived(QString)));
        QObject::connect(job, SIGNAL(networkError()), this, SLOT(slotNetworkUnavailable()));
    }
}
Exemplo n.º 6
0
QString Folder::nativeSecondPath() const
{
    return secondPath();
}
Exemplo n.º 7
0
/*
	Next().
	Advance to next playlist entry.
*/
bool	CContentDecoder::NextSheepForPlaying( int32 _forceNext )
{

	if( m_spPlaylist == NULL )
	{
		g_Log->Warning("Playlist == NULL");
		return( false );
	}
	
	if (_forceNext != 0 )
    {
        std::string secondPath("");
        
        if (m_SecondVideoInfo != NULL && m_SecondVideoInfo->m_NumIterations == 0)
           secondPath.assign(m_SecondVideoInfo->m_Path);
        
        SAFE_DELETE(m_SecondVideoInfo);
        
        if (_forceNext < 0)
        {
            uint32 _numPrevious = (uint32)(-_forceNext);
            
            if ( m_SheepHistoryQueue.size() > 0 )
            {
                if (!secondPath.empty())
                    m_NextSheepQueue.push( secondPath, false, false );
                
                std::string name;
                
                for ( uint32 i = 0; i < _numPrevious; i++ )
                {
                    while ( m_SheepHistoryQueue.pop( name, false, false ) )
                    {
                        m_NextSheepQueue.push( name, false, false );
                        
                        break;
                    }
                }
            }
        }
        else
        {
            if (!secondPath.empty())
                m_NextSheepQueue.push(secondPath, false, false);
        }
    }
				
	SAFE_DELETE(m_MainVideoInfo);
	
	m_MainVideoInfo = m_SecondVideoInfo;
	
	m_SecondVideoInfo = NULL;
	
	if (m_MainVideoInfo == NULL)
	{
		m_MainVideoInfo = GetNextSheepInfo();
		
		if (m_MainVideoInfo == NULL)
			return false;
	}
	
	if (!m_MainVideoInfo->m_bSpecialSheep)
	{
		if (m_SecondVideoInfo == NULL)
		{
			if (m_MainVideoInfo->IsLoop() && m_LoopIterations > 0 && m_MainVideoInfo->m_NumIterations < (m_LoopIterations - 1))
			{
				m_SecondVideoInfo = new sOpenVideoInfo(m_MainVideoInfo);
				m_SecondVideoInfo->m_NumIterations++;
			}
			else
				m_SecondVideoInfo = GetNextSheepInfo();

		}
	}
	else
		m_NoSheeps = true;
	
	if (!m_MainVideoInfo->IsOpen())
	{
		if (!Open( m_MainVideoInfo ))
			return false;
	}
	else
	{
		//if the video was already open (m_SecondVideoInfo previously),
		//we need to assure seamless continuation
		m_MainVideoInfo->m_NextIsSeam = true;
	}
	
	if (m_MainVideoInfo->IsOpen())
	{
		if (m_MainVideoInfo->m_NumIterations == 0)
		{
			while( m_SheepHistoryQueue.size() > 50 )
			{
				std::string tmpstr;
				
				m_SheepHistoryQueue.pop( tmpstr );
			}
			
			m_SheepHistoryQueue.push( m_MainVideoInfo->m_Path );
			
			m_spPlaylist->ChooseSheepForPlaying( m_MainVideoInfo->m_Generation, m_MainVideoInfo->m_SheepID );
		}
		
		m_NoSheeps = false;
	}
	else
		return false;
		
	if (m_bCalculateTransitions && m_SecondVideoInfo != NULL && !m_SecondVideoInfo->IsOpen() && m_MainVideoInfo->m_Last != m_SecondVideoInfo->m_SheepID && m_MainVideoInfo->m_SheepID != m_SecondVideoInfo->m_First && (m_MainVideoInfo->m_Generation / 10000) == (m_SecondVideoInfo->m_Generation / 10000))
	{
		Open( m_SecondVideoInfo );
	}

	return true;
}