Esempio n. 1
0
    def get_mtime(self):
        # FIXME: Workaround for
        # http://bugzilla.gnome.org/show_bug.cgi?id=547133
        if self._file.get_uri_scheme() in ("http", "ftp"):
            from conduit.utils import get_http_resource_last_modified

            return get_http_resource_last_modified(self._file.get_uri())
        else:
            self._get_file_info()
            mtime = self.fileInfo.get_attribute_uint64("time::modified")
            if mtime:
                return mtime
            else:
                # convert 0L -> None
                return None
Esempio n. 2
0
#common sets up the conduit environment
from common import *
import conduit.utils as Utils
import conduit.utils.Memstats as Memstats
import conduit.utils.CommandLineConverter as CommandLineConverter
import conduit.utils.Singleton as Singleton

import random
import datetime
import os.path
import sys

if is_online():
    ts = Utils.get_http_resource_last_modified("http://files.conduit-project.org/Conduit-0.3.0-screencast-small.mpeg")
    ok("Got mtime (timestamp) of http resource", ts == 1178419656.0)

    mimetype = Utils.get_http_resource_mimetype("http://files.conduit-project.org/Conduit-0.3.0-screencast-small.mpeg")
    ok("Got mimetype of http resource", mimetype == 'video/mpeg')

    size = Utils.get_http_resource_size("http://files.conduit-project.org/Conduit-0.3.0-screencast-small.mpeg")
    ok("Got size of http resource", size == 4792300)

date1 = Utils.get_http_resource_last_modified("http://foo.com/1/2/3")
ok("Got no mtime from missing http resource", date1 == None)

#Test facebook dimensions
# 1024x768 -> 604x453
w,h = Utils.get_proportional_resize(604,604,1024,768)
ok("Resized Image into facebook dimensions (%sx%s)" % (w,h), w==604 and h==453)
# 480x640 -> 453x604
# w,h = Utils.get_proportional_resize(604,604,480,640)