mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 02:18:26 +00:00
Upgrade code base to CE3
This commit is contained in:
@ -1,16 +1,14 @@
|
||||
package docspell.files
|
||||
|
||||
import scala.concurrent.ExecutionContext
|
||||
import scala.util.Using
|
||||
|
||||
import cats.effect.{Blocker, IO}
|
||||
import cats.effect._
|
||||
import cats.effect.unsafe.implicits.global
|
||||
import cats.implicits._
|
||||
|
||||
import munit._
|
||||
|
||||
class ImageSizeTest extends FunSuite {
|
||||
val blocker = Blocker.liftExecutionContext(ExecutionContext.global)
|
||||
implicit val CS = IO.contextShift(ExecutionContext.global)
|
||||
|
||||
//tiff files are not supported on the jdk by default
|
||||
//requires an external library
|
||||
@ -37,7 +35,7 @@ class ImageSizeTest extends FunSuite {
|
||||
|
||||
test("get sizes from stream") {
|
||||
files.foreach { case (uri, expect) =>
|
||||
val stream = uri.readURL[IO](8192, blocker)
|
||||
val stream = uri.readURL[IO](8192)
|
||||
val dim = ImageSize.get(stream).unsafeRunSync()
|
||||
assertEquals(dim, expect.some)
|
||||
}
|
||||
|
@ -1,19 +1,17 @@
|
||||
package docspell.files
|
||||
|
||||
import scala.concurrent.ExecutionContext
|
||||
|
||||
import cats.effect._
|
||||
import cats.effect.unsafe.implicits.global
|
||||
|
||||
import docspell.common.MimeTypeHint
|
||||
|
||||
object Playing extends IOApp {
|
||||
val blocker = Blocker.liftExecutionContext(ExecutionContext.global)
|
||||
|
||||
def run(args: List[String]): IO[ExitCode] =
|
||||
IO {
|
||||
//val ods = ExampleFiles.examples_sample_ods.readURL[IO](8192, blocker)
|
||||
//val odt = ExampleFiles.examples_sample_odt.readURL[IO](8192, blocker)
|
||||
val rtf = ExampleFiles.examples_sample_rtf.readURL[IO](8192, blocker)
|
||||
val rtf = ExampleFiles.examples_sample_rtf.readURL[IO](8192)
|
||||
|
||||
val x = for {
|
||||
odsm1 <-
|
||||
|
@ -1,29 +1,26 @@
|
||||
package docspell.files
|
||||
|
||||
import scala.concurrent.ExecutionContext
|
||||
|
||||
import cats.effect.{Blocker, IO}
|
||||
import cats.effect._
|
||||
import cats.effect.unsafe.implicits.global
|
||||
import fs2.Stream
|
||||
|
||||
object TestFiles {
|
||||
val blocker = Blocker.liftExecutionContext(ExecutionContext.global)
|
||||
implicit val CS = IO.contextShift(ExecutionContext.global)
|
||||
|
||||
val letterSourceDE: Stream[IO, Byte] =
|
||||
ExampleFiles.letter_de_pdf
|
||||
.readURL[IO](8 * 1024, blocker)
|
||||
.readURL[IO](8 * 1024)
|
||||
|
||||
val letterSourceEN: Stream[IO, Byte] =
|
||||
ExampleFiles.letter_en_pdf
|
||||
.readURL[IO](8 * 1024, blocker)
|
||||
.readURL[IO](8 * 1024)
|
||||
|
||||
lazy val letterDEText =
|
||||
ExampleFiles.letter_de_txt
|
||||
.readText[IO](8 * 1024, blocker)
|
||||
.readText[IO](8 * 1024)
|
||||
.unsafeRunSync()
|
||||
|
||||
lazy val letterENText =
|
||||
ExampleFiles.letter_en_txt
|
||||
.readText[IO](8 * 1024, blocker)
|
||||
.readText[IO](8 * 1024)
|
||||
.unsafeRunSync()
|
||||
}
|
||||
|
@ -1,8 +1,7 @@
|
||||
package docspell.files
|
||||
|
||||
import scala.concurrent.ExecutionContext
|
||||
|
||||
import cats.effect._
|
||||
import cats.effect.unsafe.implicits.global
|
||||
import cats.implicits._
|
||||
|
||||
import docspell.common.Glob
|
||||
@ -11,12 +10,9 @@ import munit._
|
||||
|
||||
class ZipTest extends FunSuite {
|
||||
|
||||
val blocker = Blocker.liftExecutionContext(ExecutionContext.global)
|
||||
implicit val CS = IO.contextShift(ExecutionContext.global)
|
||||
|
||||
test("unzip") {
|
||||
val zipFile = ExampleFiles.letters_zip.readURL[IO](8192, blocker)
|
||||
val uncomp = zipFile.through(Zip.unzip(8192, blocker, Glob.all))
|
||||
val zipFile = ExampleFiles.letters_zip.readURL[IO](8192)
|
||||
val uncomp = zipFile.through(Zip.unzip(8192, Glob.all))
|
||||
|
||||
uncomp
|
||||
.evalMap { entry =>
|
||||
|
Reference in New Issue
Block a user